Open MiguelG97 opened 3 months ago
What version of Tailwind CSS are you using?
"tailwindcss": "^3.4.1",
What build tool (or framework if it abstracts the build tool) are you using?
"next": "14.2.2",
What version of Node.js are you using?
v20.10.0
What browser are you using?
Chrome
What operating system are you using?
Windows
Describe your issue
Nextjs creates the default tailwind.config.ts file structure:
import type { Config } from "tailwindcss"; const config: Config = { content: [ "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./modules/**/*.{js,ts,jsx,tsx,mdx}", "./app/**/*.{js,ts,jsx,tsx,mdx}", ], theme: { extend: { colors: { ... }, }, }, plugins: [], }; export default config;
However, when referencing the theme in another file through:
import resolveConfig from "tailwindcss/resolveConfig"; import tailwindConfig from "@/tailwind.config"; export const themeTailwind = resolveConfig(tailwindConfig);
the extended colors types are not loaded. Is this an expected behavior using the following syntax? import type { Config } from "tailwindcss";
import type { Config } from "tailwindcss";
Kind of annoying because I needed to do the following modification for types to work properly:
/** @type {import('tailwindcss').Config} */ const config = {...} export default config;
Just add the same problem and this did the trick
In your tailwind.config.ts
tailwind.config.ts
const config = { //Your tailwind config here... } satisfies Config;
What version of Tailwind CSS are you using?
What build tool (or framework if it abstracts the build tool) are you using?
"next": "14.2.2",
What version of Node.js are you using?
v20.10.0
What browser are you using?
Chrome
What operating system are you using?
Windows
Describe your issue
Nextjs creates the default tailwind.config.ts file structure:
However, when referencing the theme in another file through:
the extended colors types are not loaded. Is this an expected behavior using the following syntax?
import type { Config } from "tailwindcss";
Kind of annoying because I needed to do the following modification for types to work properly: