Skip to content

Commit 64ffd22

Browse files
committed
fix: rename tailwind.config.ts → .js to avoid import issues
1 parent adb2e32 commit 64ffd22

File tree

6 files changed

+51
-89
lines changed

6 files changed

+51
-89
lines changed

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6+
"build:tailwind": "ts-node --project tsconfig.tsnode.json scripts/generate-tailwind-config.ts",
67
"build": "next build",
78
"build:turbo": "next build --turbo",
89
"dev": "next dev --port 3000",

frontend/pnpm-lock.yaml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
// scripts/generate-tailwind-config.ts
3+
import fs from 'fs';
4+
import path from 'path';
5+
import tailwindConfig from '../tailwind.config.js'; // ← now .js
6+
7+
const configStr = JSON.stringify(tailwindConfig, (key, value) => {
8+
if (typeof value === 'function') {
9+
return `Function:${value.name || 'anonymous'}`;
10+
}
11+
return value;
12+
}, 2);
13+
14+
const cjsContent = `
15+
// Auto-generated from tailwind.config.ts
16+
// DO NOT EDIT MANUALLY
17+
module.exports = ${configStr};
18+
`;
19+
20+
const outputPath = path.resolve(__dirname, '../tailwind.config.generated.js');
21+
fs.writeFileSync(outputPath, cjsContent);
22+
console.log('✅ Generated: tailwind.config.generated.js');

frontend/tailwind.config.cjs

Lines changed: 4 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,5 @@
1-
import type { Config } from "tailwindcss";
2-
import { heroui } from "@heroui/react";
3-
import animate from "tailwindcss-animate";
1+
// tailwind.config.cjs
2+
// This file exists to support tools that don't support ESM or TypeScript.
3+
// It imports the real config from tailwind.config.ts via a generated .js file.
44

5-
const config: Config = {
6-
content: [
7-
"./src/**/*.{js,ts,jsx,tsx,mdx}",
8-
"./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}",
9-
],
10-
darkMode: "class",
11-
theme: {
12-
extend: {
13-
colors: {
14-
background: "hsl(var(--background))",
15-
foreground: "hsl(var(--foreground))",
16-
border: "hsl(var(--border))",
17-
text: "hsl(var(--text))",
18-
"owasp-blue": "#98AFC7",
19-
card: {
20-
DEFAULT: "hsl(var(--card))",
21-
foreground: "hsl(var(--card-foreground))",
22-
},
23-
popover: {
24-
DEFAULT: "hsl(var(--popover))",
25-
foreground: "hsl(var(--popover-foreground))",
26-
},
27-
primary: {
28-
DEFAULT: "hsl(var(--primary))",
29-
foreground: "hsl(var(--primary-foreground))",
30-
},
31-
secondary: {
32-
DEFAULT: "hsl(var(--secondary))",
33-
foreground: "hsl(var(--secondary-foreground))",
34-
},
35-
muted: {
36-
DEFAULT: "hsl(var(--muted))",
37-
foreground: "hsl(var(--muted-foreground))",
38-
},
39-
accent: {
40-
DEFAULT: "hsl(var(--accent))",
41-
foreground: "hsl(var(--accent-foreground))",
42-
},
43-
destructive: {
44-
DEFAULT: "hsl(var(--destructive))",
45-
foreground: "hsl(var(--destructive-foreground))",
46-
},
47-
input: "hsl(var(--input))",
48-
ring: "hsl(var(--ring))",
49-
chart: {
50-
1: "hsl(var(--chart-1))",
51-
2: "hsl(var(--chart-2))",
52-
3: "hsl(var(--chart-3))",
53-
4: "hsl(var(--chart-4))",
54-
5: "hsl(var(--chart-5))",
55-
},
56-
},
57-
borderRadius: {
58-
lg: "var(--radius)",
59-
md: "calc(var(--radius) - 2px)",
60-
sm: "calc(var(--radius) - 4px)",
61-
},
62-
keyframes: {
63-
scroll: {
64-
"0%": { transform: "translateX(0)" },
65-
"100%": { transform: "translateX(-500%)" },
66-
},
67-
},
68-
animation: {
69-
scroll: "scroll 0.5s linear infinite",
70-
},
71-
},
72-
},
73-
plugins: [heroui(), animate],
74-
};
75-
76-
export default config;
5+
module.exports = require('./tailwind.config.generated.js');
File renamed without changes.

frontend/tsconfig.tsnode.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"allowImportingTsExtensions": true,
5+
"noEmit": true
6+
},
7+
"include": [
8+
"scripts/generate-tailwind-config.ts"
9+
]
10+
}

0 commit comments

Comments
 (0)