[Vuejs]-"default" is not exported by "tailwind.config.js"

1👍

tailwindcss added native ESM (and TypeScript) support in v3.3.

https://tailwindcss.com/blog/tailwindcss-v3-3#esm-and-type-script-support.

In my case, I migrated the tailwind.config.js by changing imports & exports:

Before:

const colors = require('tailwindcss/colors');
const plugin = require("tailwindcss/plugin");

module.exports = { ... }

After:

import colors from "tailwindcss/colors";
import plugin from "tailwindcss/plugin";

export default { ... }

within my vite codebase, I was then able to access config values like this

import resolveConfig from "tailwindcss/resolveConfig";

import tailwindConfig from "../../tailwind.config.js";

const { theme } = resolveConfig(tailwindConfig);

theme.colors.gray[500]

Leave a comment