Comments (3)
1.0.0+ is ESM only. See the link in the error messsage.
from vite-plugin-static-copy.
it's used as import, but it seems not that simple as it declared.
I also downgraded to 0.17. which support cjs in its build.
if this is not supported, I may need to use copy command or other plugin instead.
vite.config.js:2:31:
2 │ import { viteStaticCopy } from 'vite-plugin-static-copy';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~
failed to load config from /Users/allenkim/projects/elements-x/vite.config.js
=> Failed to build the preview
Error: Build failed with 1 error:
node_modules/vite/node_modules/esbuild/lib/main.js:1373:27: ERROR: [plugin: externalize-deps] "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.
at failureErrorWithLog (./node_modules/vite/node_modules/esbuild/lib/main.js:1650:15)
at ./node_modules/vite/node_modules/esbuild/lib/main.js:1058:25
at runOnEndCallbacks (./node_modules/vite/node_modules/esbuild/lib/main.js:1485:45)
at buildResponseToResult (./node_modules/vite/node_modules/esbuild/lib/main.js:1056:7)
at ./node_modules/vite/node_modules/esbuild/lib/main.js:1085:16
at responseCallbacks.<computed> (./node_modules/vite/node_modules/esbuild/lib/main.js:703:9)
at handleIncomingPacket (./node_modules/vite/node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (./node_modules/vite/node_modules/esbuild/lib/main.js:679:7)
at Socket.emit (node:events:511:28)
at addChunk (node:internal/streams/readable:332:12)
from vite-plugin-static-copy.
Have same error with vite5
and latest Nx
from vite-plugin-static-copy.
Related Issues (20)
- "vite-plugin-static-copy" resolved to an ESM file HOT 1
- Consider normalizing paths by default HOT 1
- It doesn't copy any files
- How could I copy different files in development mode and production mode?
- Set content-type header from target filename HOT 1
- Plugin stopped copying files
- watcher: Cannot read properties of undefined (reading 'close') HOT 6
- Add support for Vite 5 HOT 1
- Error message while/after files copied HOT 6
- feature request: support URL objects HOT 1
- The entire module stopped working HOT 3
- How to copy wasm files for vite-plugin-comlink HOT 1
- The entire module stopped working HOT 3
- feature request: .vue file MIME Type support HOT 1
- Posibility to only use for serve or build mode
- Using structured:true generates wrong path HOT 3
- The 1.0.1 version `rename` update HOT 2
- "vite-plugin-static-copy" resolved to an ESM file HOT 3
- Documentation: Some words on what "good uses" for this package are would be welcome HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-static-copy.