Error: Can't resolve 'tailwindcss' in '/path/../@import 'tailwindcss'; #16097
-
Greetings. I am trying to compile tailwind using // build.js
import tailwindPostcss from '@tailwindcss/postcss';
import { readFile, writeFile } from 'node:fs/promises';
import postcss from 'postcss';
const baseFile = await readFile('./src/tailwind.css', 'utf8');
const res = await postcss([
tailwindPostcss({
base: baseFile,
optimize: false
})
]).process(baseFile, { from: baseFile, to: './out/index.css' });
await writeFile('./out/index.css', res.css); and here is my /* src/tailwind.css */
@import 'tailwindcss';
@theme {
--font-jetbrains: 'Jetbrains Mono', 'monospace';
}
body {
background-image: url('http://localhost:3001/static/bg.jpg');
} When I run the script I am getting a bunch of errors that I can't figure out:
Oddly enough, if I remove the Anyone who can explain to me what is going on and how to fix it? There is no documentation available for the Here is a reproducible repository: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
const res = await postcss([
tailwindPostcss({
- base: baseFile,
+ base __dirname,
optimize: false
})
-]).process(baseFile, { from: baseFile, to: './out/index.css' });
+]).process(baseFile, { from: './src/tailwind.css', to: './out/index.css' }); |
Beta Was this translation helpful? Give feedback.
from
andbase
should be file paths, not file content: