Error: Dynamic require of "path" is not supported
See original GitHub issueAfter updating to v0.13.2 this errors stops the build (tsc && vite build) on node v16.18.0:
error during build:
Error: Dynamic require of "path" is not supported
at file:///xxxx/node_modules/vite-plugin-pwa/dist/chunk-22M6QDW2.mjs:12:9
at node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js (file:///xxx/node_modules/vite-plugin-pwa/dist/rollup-plugin-replace.es-E5RG33HN.mjs:1316:16)
at __require2 (file:///xxx/node_modules/vite-plugin-pwa/dist/chunk-22M6QDW2.mjs:15:50)
at node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js (file:///xxx/node_modules/vite-plugin-pwa/dist/rollup-plugin-replace.es-E5RG33HN.mjs:1460:22)
...
When I change “type”=“module” to “commonjs” in package.json, error goes away
Related vite issues I found:
Suspect PR:
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Error: Dynamic require of "path" is not supported #33 - GitHub
1 i get the following error when building: failed to load config from vite.config.js error when starting dev server: Error: Dynamic require of...
Read more >Vitejs | Uncaught Error: Dynamic require of "<path>.svg" is not ...
I don't know if it will for react-flagpack; this is likely a require statement that is breaking the build... I found a solution...
Read more >dynamic require of "path" is not supported - GitHub - You.com
Describe the bug Im trying to use this awesome looking lib with esbuild targeting cloudflare workers and I am getting the following error:...
Read more >Netlify Serverless Typescript functions fail with dynamic requires
Typescript serverless functions seem to be failing for me with {"errorType":"Error","errorMessage":"Dynamic require of \"util\" is not supported" ...
Read more >vite-plugin-dynamic-import - npm
vite-plugin-dynamic-import. TypeScript icon, indicating that this package has built-in type declarations. 1.2.4 • Public • Published a month ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
shoud be fixed with
v0.13.3Thanks! Working now with v0.13.3 👍