-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Don't use browser versions of libraries if they are installed separately #1657
Comments
Maybe you could make a PR to https://github.com/webpack/node-libs-browser to upgrade it? |
Of course, and I will. But still, this behaviour is quite weird, and it could have allowed me to work around the outdated node-libs-browser package |
node-libs-browser seems to not want to do a major bump yet, idk why. maybe it's just that nobody has time to look at it. e; I guess you can use this babel plugin: https://www.npmjs.com/package/babel-plugin-module-resolver |
Thank you, that worked! |
My personal preference with this would be for Parcel to not include |
a lot of npm modules depend on node core modules, particularly (e; i agree explaining it in docs would be helpful.) |
Wouldn't it be better to have it be an extension of the auto-install behavior, instead of silently bundling an out-of-date collection of modules? Adding specific packages as project dependencies as necessary would avoid issues like this one and also be much more explicit to users. |
That actually makes a lot of sense! |
If parcel relies in the deprecated |
We don't use the |
🐛 bug report
Browser versions of common libraries (like
events
for example) are used, even when they are explicitly installed with NPM.🎛 Configuration (.babelrc, package.json, cli command)
I'm working on a pretty simple Vue.js project.
My
.babelrc
is as simple as it gets:{ "presets": ["env"] }
My
package.json
(only relevant bits):I start Parcel with
npm run dev
🔦 Context
Specifically for my use case, I want to use the standard EventEmitter in my code, like so:
import EventEmitter from 'events';
. This will use a browser implementation, instead of the built-in one from Node.js (as I'm building for the browser). So far so good.However, I want to use the
eventNames()
method, which was added in Node.js v6.0.0, and is supported in modern versions of theevents
module/shim (at least v3.0.0, maybe even earlier). Apparently, theevents
implementation Parcel uses (provided bynode-libs-browser
) is quite outdated (v1.x.x, I think), and doesn't support this new feature.🤔 Expected Behavior
To resolve this issue, I installed
events@3.0.0
explicitly with NPM, hoping it would use that one, over the outdated version it used out-of-the-box.😯 Current Behavior
Apparently, it doesn't. It still uses the old version from
node-libs-browser
.💁 Possible Solution
Ideally, if a package is installed with NPM, Parcel should always choose that one, instead of using the browser shims.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: