-
-
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
Add support for excluding specific node_modules #4072
Conversation
Benchmark Resultspackages/benchmarks/kitchen-sink ✅
Timings
Cold Bundles
Cached Bundles
packages/benchmarks/react-hn ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
packages/benchmarks/ak-editor ✅
Timings
Cold Bundles
Cached Bundles
|
I do think we should have a general exclude as well, with either a custom or peerDependency field. |
How is this supposed to work for browser builds? I’m using: {
"browser": "web/dist/app.js",
"source": "frontend/js/app.js",
"targets": {
"browser": {
"includeNodeModules": {
"jquery": false
}
}
}
} It builds But if I do (see #3963): {
"default": "web/dist/app.js",
"source": "frontend/js/app.js",
"targets": {
"default": {}
},
} Then it builds without How can I setup Parcel 2 to build for browser (without Combination of: {
"default": "web/dist/app.js",
"source": "frontend/js/app.js",
"targets": {
"default": {
"includeNodeModules": {
"jquery": false
}
}
}
} yields:
|
I wish to use it like with an old v1 Parcel and its {
"dependencies": {
"bootstrap": "^4.4.1",
"jquery": "^3.3.1",
"popper.js": "^1.15.0"
},
"devDependencies": {
"less": "^3.11.1",
"parcel-bundler": "^1.12.4",
"parcel-plugin-externals": "^0.2.0"
},
"browserslist": [
"> 1%",
"not dead"
],
"main": "web/dist/app.js",
"source": "frontend/js/app.js",
"externals": {
"jquery": "jQuery",
"bootstrap": true,
"popper.js": true
}
} In my code I use It works in v1, so I’m just wondering if this is possible in Parcel v2. Otherwise, what’s the profit of using external React or something if output code is not runnable in browsers? |
Related: #144, #3305, #3753.
This adds support for excluding specific node_modules from a bundle. The inverse was already possible via
includeNodeModules
using the array syntax, but now it's possible to use object syntax to exclude specific node_modules in a certain target.#3753 proposed doing this via
peerDependencies
, but that doesn't allow specifying node modules to include/exclude per target. We may want to support it as a shortcut forincludeNodeModules
across all targets, however.