New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules marked as external
should always be treated as external
#3408
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/9uvvr5HXepXaAyeadZf8UW6Ez8p6 |
snowpack/src/sources/local.ts
Outdated
), | ||
]; | ||
|
||
const filteredExternal = (ext: string) => ext !== _packageName && !NEVER_PEER_PACKAGES.has(ext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ext
here meaning external
? I would probably rename that variable for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I totally understand where the previous behavior was letting node-fetch
through, but this is a welcome change nonetheless. This is significantly easier to read through.
@natemoo-re it was coming through because it was filtering the full list of externals. This change makes it so that it only filters the package.json dependencies (and peer and dev) lists. The externals coming from your config are not filtered any more, so that means we always honor your config choices. |
Edit: I had a different version of snowpack in the host app's package.json. Updating it to the same version in the dependencies seems to have fixed the issue. |
Changes
Previously
node-fetch
was always being bundled. This was because, as the thought goes, it's small so we should never externalize it.However if a config explicitly marks it as external (rather than being implicitly external through a dependency) we should honor that.
Testing
Adds a test for the scenario.
Docs
N/A, bug fix.