sapphi-red / vite-plugin-static-copy

rollup-plugin-copy with dev server support.
MIT License
299 stars 32 forks source link

The entire module stopped working #74

Closed wuhaohuang closed 11 months ago

wuhaohuang commented 11 months ago

hi~ I made this update progress: Bump vite-plugin-static-copy from 0.17.0 to 1.0.0 and vite from 4.3.9 to 5.0.10.

Now the module no longer loads on Vite in any way:

✘ [ERROR] "vite-plugin-static-copy" resolved to an ESM file. ESM file cannot be loaded by `require`. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]
image

When I downgraded, everything went back to normal. So the problem is in the version 1.0.0 Or I renamed the file vite.config.js to vite.config.mjs and this is working now.

Your module was using the file name as a reference to know if it was an ESM or not. pls check and good luck.

wuhaohuang commented 11 months ago

replenish: my current naming is vite.config.ts, is not working

sirchnik commented 11 months ago

The package has to be a module.

sapphi-red commented 11 months ago

Please read the error message and the linked page.

"vite-plugin-static-copy" resolved to an ESM file. ESM file cannot be loaded by require. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.