Gathering detailed insights and metrics for @yelo/rollup-node-external
Gathering detailed insights and metrics for @yelo/rollup-node-external
Gathering detailed insights and metrics for @yelo/rollup-node-external
Gathering detailed insights and metrics for @yelo/rollup-node-external
npm install @yelo/rollup-node-external
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
9 Stars
66 Commits
3 Watching
1 Branches
1 Contributors
Updated on 20 Oct 2022
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-33.8%
624
Compared to previous day
Last week
-19.4%
4,160
Compared to previous week
Last month
29.4%
18,238
Compared to previous month
Last year
29.6%
151,472
Compared to previous year
Easily exclude node modules in rollup, forked from webpack-node-externals
rollup allows you to define external - modules that should not be bundled.
When bundling with rollup for the backend - you usually don't want to bundle its node_modules
dependencies.
This library creates an external function that ignores node_modules
when bundling in rollup.
Forked from liady/webpack-node-externals
1npm install @yelo/rollup-node-external --save-dev
In your rollup.config.js
:
1var external = require('@yelo/rollup-node-external'); 2... 3module.exports = { 4 ... 5 external: external(), // in order to ignore all modules in node_modules folder 6 plugins: [ 7 ... 8 // import node-resolve plugin 9 require('rollup-plugin-node-resovle')(), 10 ... 11 ], 12 ... 13};
And that's it. All node modules will no longer be bundled but will be left as require('module')
.
This library scans the node_modules
folder for all node_modules names, and builds an external function that tells rollup not to bundle those modules, or any sub-modules of theirs.
This library accepts an options
object.
options.whitelist (=[])
An array for the external
to whitelist, so they will be included in the bundle. Can accept exact strings ('module_name'
), regex patterns (/^module_name/
), or a function that accepts the module name and returns whether it should be included.
Important - if you have set aliases in your rollup config with the exact same names as modules in node_modules, you need to whitelist them so rollup will know they should be bundled.
options.importType (='commonjs')
The method in which unbundled modules will be required in the code. Best to leave as commonjs
for node modules.
options.modulesDir (='node_modules')
The folder in which to search for the node modules.
options.modulesFromFile (=false)
Read the modules from the package.json
file instead of the node_modules
folder.
1var external = require('@yelo/rollup-node-external'); 2... 3module.exports = { 4 ... 5 external: external({ 6 // this WILL include `jquery` in the bundle, as well as `lodash/*` 7 whitelist: ['jquery', /^lodash/] 8 }), 9 plugins: [ 10 ... 11 require('rollup-plugin-node-resovle')(), 12 ... 13 ], 14 ... 15};
For most use cases, the defaults of importType
and modulesDir
should be used.
1npm run test
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More