Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with npm run build with recent vite versions #4

Closed
mangkang opened this issue Aug 5, 2022 · 4 comments
Closed

Issue with npm run build with recent vite versions #4

mangkang opened this issue Aug 5, 2022 · 4 comments

Comments

@mangkang
Copy link

mangkang commented Aug 5, 2022

Hi,

Thanks for creating this very elegant css solution. I am encountering the following error when building with vite (3.0.4) using npm run build:

[vite:load-fallback] Could not load virtual:inline-css-modules/App-0.module.css?used (imported by src/App.tsx): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00virtual:inline-css-modules/App-0.module.css?used'
error during build:
TypeError [PLUGIN_ERROR]: Could not load virtual:inline-css-modules/App-0.module.css?used (imported by src/App.tsx): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00virtual:inline-css-modules/App-0.module.css?used'
at open (node:internal/fs/promises:450:10)
at Object.readFile (node:internal/fs/promises:795:20)
at Object.load (file:///Users/yongm1/my-react-app/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:43230:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///Users/yongm1/my-react-app/node_modules/rollup/dist/es/shared/rollup.js:22096:98
at async Queue.work (file:///Users/yongm1/my-react-app/node_modules/rollup/dist/es/shared/rollup.js:22773:32)

This contains something similar to the example (I am using it in React):
import { css } from 'vite-plugin-inline-css-modules'

const classes = css.root { background-color: #1f1; @apply rounded-md; }

Please let me know if there is any way i could work around this.

Thanks.

@bluskript
Copy link
Owner

bluskript commented Aug 6, 2022

Hey,

It seems that Vite 3 has had breaking changes. I have now fixed it and published it. @mangkang can you try doing this with vite-plugin-inline-css-modules@0.0.5?

Sorry for the slow fix 😅

@mangkang
Copy link
Author

mangkang commented Aug 8, 2022

Hi @bluskript,

Thanks for the quick response. I tried the latest code and it seems the problem still exists. This can be reproduced in the react-demo directory as well when we do npm run build.

npm run build

build
vite build

vite v3.0.4 building for production...
✓ 5 modules transformed.
[vite:load-fallback] Could not load virtual:inline-css-modules/Root-0.module.css?used (imported by src/Root.tsx): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00virtual:inline-css-modules/Root-0.module.css?used'
error during build:
TypeError [PLUGIN_ERROR]: Could not load virtual:inline-css-modules/Root-0.module.css?used (imported by src/Root.tsx): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00virtual:inline-css-modules/Root-0.module.css?used'
at open (node:internal/fs/promises:450:10)
at Object.readFile (node:internal/fs/promises:795:20)
at Object.load (file:///Users/yongm1/vite-plugin-inline-css-modules/node_modules/vite/dist/node/chunks/dep-71eb12cb.js:43230:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///Users/yongm1/vite-plugin-inline-css-modules/node_modules/rollup/dist/es/shared/rollup.js:22096:98
at async Queue.work (file:///Users/yongm1/vite-plugin-inline-css-modules/node_modules/rollup/dist/es/shared/rollup.js:22773:32)

@bluskript
Copy link
Owner

bluskript commented Aug 8, 2022

@mangkang agh! i thought dev was what was broken, didn't realize build was what was actually not working. It should work now. Try with the latest version (0.0.6)!

@mangkang
Copy link
Author

mangkang commented Aug 8, 2022

@bluskript Works fine now. Thanks for the quick fix!

@mangkang mangkang closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants