GithubHelp home page GithubHelp logo

Comments (3)

sapphi-red avatar sapphi-red commented on June 3, 2024

1.0.0+ is ESM only. See the link in the error messsage.

from vite-plugin-static-copy.

allenhwkim avatar allenhwkim commented on June 3, 2024

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.

Lonli-Lokli avatar Lonli-Lokli commented on June 3, 2024

Have same error with vite5 and latest Nx

from vite-plugin-static-copy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.