Include only specific node_modules
See original GitHub issuePlease describe your issue: Let’s assume that I want to exclude these files from packaging:
- npm-debug
- gulpfile.js
- .vscode
So setting --ignore option like this:
--ignore='npm-debug|gulpfile\.js|\.vscode'
It’s working. But how to I make regex that exclude only specific node_modules with above regex? I tried:
--ignode='npm-debug|gulpfile\.js|\.vscode|^((?!node_modules/mqtt).)$' // NOT WORKING
but it won’t worked. I know my regex was wrong, but I don’t know how should I do now. Literally, I’m stucked now. Is there a something another option to include specific files from --ignore option? Else, how do I resolve this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
How to include only specific module in webpack without ...
I'm working with a monorepo node.js project with the following structure: rootDir packageA packageB packageC. I want to produce a bundle of ...
Read more >How To Use Node.js Modules with npm and package.json
The node_modules folder contains every installed dependency for your project. In most cases, you should not commit this folder into your version ...
Read more >Modules: Packages | Node.js v19.3.0 Documentation
Within a "type": "module" package, Node.js can be instructed to interpret a particular file as CommonJS by naming it with a .cjs extension...
Read more >package.json - npm Docs
Therefore, the name can't contain any non-URL-safe characters. Some tips: Don't use the same name as a core Node module. Don't put "js"...
Read more >Using Node.js Modules with Azure applications - Microsoft Learn
Each module within the node_modules directory maintains its own directory that contains any modules that it depends on, and this behavior ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rico345100 If you don’t want a node_module to be included in production, just set it as a devDepednency and it will be pruned automatically
@rico345100
Untested but this regexp should do what you want
Basically add things that you want to ignore inside those brackets. The key bit to that regexp is
^\/
which forces the match to be at the start of the path 👍