question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot pass an npm dependency as an entrypoint to build

See original GitHub issue

Describe 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sibbngcommented, Jan 29, 2022

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?

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.

0reactions
patak-devcommented, Jan 29, 2022

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found