Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error message when node module doesn't exist doesn't... exist #1748

Open
KernelDeimos opened this issue Jul 21, 2024 · 0 comments
Open

Error message when node module doesn't exist doesn't... exist #1748

KernelDeimos opened this issue Jul 21, 2024 · 0 comments

Comments

@KernelDeimos
Copy link

  • Rollup Plugin Name: @rollup/plugin-node-resolve
  • Rollup Plugin Version: v15.2.3

Expected Behavior / Situation

When a module doesn't exist (for example if you import the wrong name; this is very easy to do for some packages, for example @xterm/xtermjs should be @xterm/xterm when importing xtermjs), running rollup should result in an error message that says something like "hey, this package doesn't exist"

Actual Behavior / Situation

The output rollup gives is exactly the same as it is when this plugin isn't even used.

If someone doesn't notice that, that might additionally get confused by a message like this:

xterm/xtermjs (imported by "src/main.js")
(!) Missing global variable name
https://rollupjs.org/configuration-options/#output-globals
Use "output.globals" to specify browser global variable names corresponding to external modules:
@xterm/xtermjs (guessing "xtermjs")

Which brings up questions like: "why is it guessing?", "is rollup messing up my imports?", "is destructuring not supported?"

Modification Proposal

Given the following output, add the message I wrote between the markers <<< and >>>, in red color.

src/main.js → dist/bundle.js...
(!) Unresolved dependencies
https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
@xterm/xtermjs (imported by "src/main.js")
<<<
!!! The module `@xterm/xtermjs` was not found!
  import { Terminal } from '@xterm/xtermjs';
                           ^
>>>
(!) Missing global variable name
https://rollupjs.org/configuration-options/#output-globals
Use "output.globals" to specify browser global variable names corresponding to external modules:
@xterm/xtermjs (guessing "xtermjs")
created dist/bundle.js in 114ms
[edube@zenbook terminal]$ npx rollup -c rollup.config.js

src/main.js → dist/bundle.js...
created dist/bundle.js in 748ms
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant