I'm working on a NextJS
app and i put some tailwind
configuration in tailwind.config.js
file:
const Config = {
darkMode: ["class"],
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./sanity/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
screens: {
xs: "475px",
},
colors: {
primary: {
100: "#FFE8F0",
DEFAULT: "#EE2B69",
},
secondary: "#FBE843",
black: {
100: "#333333",
200: "#141413",
300: "#7D8087",
DEFAULT: "#000000",
},
white: {
100: "#F7F7F7",
DEFAULT: "#FFFFFF",
},
},
fontFamily: {
"work-sans": ["var(--font-work-sans)"],
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
boxShadow: {
100: "2px 2px 0px 0px rgb(0, 0, 0)",
200: "2px 2px 0px 2px rgb(0, 0, 0)",
300: "2px 2px 0px 2px rgb(238, 43, 105)",
},
},
},
// plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")],
};
export default Config;
it runs localhost
with no issue, but if i uncomment the line where it requires plugins it gets stuck at compiling phase, what's wrong here ?
using import instead of require solved the issue for me:
import tailwindAnimate from "tailwindcss-animate";
import tailwindTypography from "@tailwindcss/typography";
const Config = {
...
plugins: [tailwindAnimate, tailwindTypography],
};
export default Config;
This is the proper way to do this when using ES Modules