snowpack: [BUG] support for @tailwindcss/jit
Bug Report Quick Checklist
- I am on the latest version of Snowpack & all plugins.
- I use package manager pnpm.
- I run Snowpack on OS Mac
- I run Snowpack on Node.js v14+
Describe the bug
When I change the postcss config files by replacing tailwindcss to @tailwindcss/jit, build breaks with following error
[snowpack] ! building source files...
[snowpack] ✘ file:///temp/snowpack-tailwind-jit/src/app.css
node:internal/process/promises:227
triggerUncaughtException(err, true /* fromPromise */);
^
Error: ENOENT: no such file or directory, stat 'stdin'
at Object.statSync (node:fs:1127:3)
at trackModified (/temp/snowpack-tailwind-jit/node_modules/@tailwindcss/jit/src/lib/setupContext.js:187:26)
at /temp/snowpack-tailwind-jit/node_modules/@tailwindcss/jit/src/lib/setupContext.js:652:38
at /temp/snowpack-tailwind-jit/node_modules/@tailwindcss/jit/src/index.js:34:49
at LazyResult.runOnRoot (/temp/snowpack-tailwind-jit/node_modules/postcss/lib/lazy-result.js:303:16)
at LazyResult.runAsync (/temp/snowpack-tailwind-jit/node_modules/postcss/lib/lazy-result.js:355:26)
at LazyResult.async (/temp/snowpack-tailwind-jit/node_modules/postcss/lib/lazy-result.js:205:30)
at LazyResult.then (/temp/snowpack-tailwind-jit/node_modules/postcss/lib/lazy-result.js:190:17) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: 'stdin',
__snowpackBuildDetails: { name: '@snowpack/postcss-transform', step: 'transform' }
}
To Reproduce
git clone https://github.com/bhvngt/snowpack-tailwindcss-jitsnowpack build
Expected behavior
Build should not break
Anything else?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (5 by maintainers)
@Xeevis It works now! Thank you very much!
I’ve created a simple plugin that will automatically monitor all template files watched by the the TailwindCSS JIT and will refresh all CSS processed by the Snowpack that import TailwindCSS. Nothing is hardcoded so ideally it should work for all scenarios without extra configuration.
Please see the NPM package or github repository for install instructions and let me know if it works for you.
Thank you for the work-around! I adapted it very slightly to work with all
tsxfiles instead of.sveltefiles.I found snowpack doesn’t support local plugins so I added a dev dependency using the
file:prefix which seemed lighter weight than publishing an NPM package.snowpack-css-refresh-plugin/index.js
package.json
I have created a temporary plugin to fix the issue at
All it does is watch for changes to svelte files and then marks
src/App.cssas changed. But it worksTo use:
npm install --save-dev @rohfle/snowpack-plugin-watchappcssthen add
@rohfle/snowpack-plugin-watchappcssto your plugins insnowpack.config.jsThanks @Xeevis that plugin helped me a lot!
@drwpow It’s awesome to see progress here, thanks! That said, it’s probably worth addressing https://github.com/snowpackjs/snowpack/issues/3041 because jit is pretty much unusable if you have to restart snowpack every time you add a new class. I was hoping that because it was documented now it would be usable, but that doesn’t appear to be the case.