Cannot pass an npm dependency as an entrypoint to build
See original GitHub issueDescribe the bug
If you attempt to pass an npm dependency to vite.build’s rollupOptions.input
you will get an error like this:
Could not resolve entry module (packages/astro/test/fixtures/static-build-frameworks/@astrojs/renderer-lit/client-shim.js).
This is a regression caused here: https://github.com/vitejs/vite/pull/5601/files#diff-aa53520bfd53e6c24220c44494457cc66370fd2bee513c15f9be7eb537a363e7R272-R286
It assumes that all entrypoints are files within the project root and not npm package dependencies.
Reproduction
https://stackblitz.com/edit/vitejs-vite-pcuytf?file=build.mjs
System Info
System:
OS: macOS 12.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 178.72 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - ~/.volta/tools/image/node/14.17.0/bin/node
Yarn: 1.22.10 - ~/.volta/tools/image/yarn/1.22.10/bin/yarn
npm: 7.11.2 - ~/.volta/tools/image/npm/7.11.2/bin/npm
Browsers:
Chrome: 97.0.4692.71
Firefox: 96.0
Safari: 15.2
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Docker: ENTRYPOINT can't execute command because it ...
If I run npm run watch in my local environment the command works but when I try running the container it doesn't and...
Read more >fails to invoke npm when used in run-scripts #1734 - GitHub
Can replicate it using a simple package.json file with a dependency. This example assumes the package.json is owned by user 1001. > docker...
Read more >package.json - npm Docs
The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can't...
Read more >10 best practices to containerize Node.js web applications ...
Read more tips and best practices for building secure container images. 2. Install only production dependencies in the Node.js Docker image. The ...
Read more >Putting Your NodeJS App in a Docker Container - This Dot Labs
The content passed to CMD is tacked onto the end of the command passed to ENTRYPOINT to create a complete command to start...
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 FreeTop 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
Top GitHub Comments
Ok, I look back the issue in unocss. Error comes from
rollup-plugin-dynamic-import-variables
. Probably the source of problem is here. I’m ok with the revert.I think we should revert and find a very good reason to change the default way rollup input works. Reviewing the issue where we change this, I think we didn’t justify the change enough. The linked unocss issue could have been resolved by resolving in the config, no?