logo
down
shadow

Webpack 4x how to exclude multiple node_modules directories


Webpack 4x how to exclude multiple node_modules directories

Content Index :

Webpack 4x how to exclude multiple node_modules directories
Tag : webpack , By : bjorngylling
Date : January 11 2021, 05:14 PM

it should still fix some issue You seem to be almost there. When you build app1 and only want to use node_modules from app1, you can use resolve.modules with a relative path app1/node_modules.
Solution with resolve.modules
const path = require("path");
...

module.exports = {
  ...
  resolve: {
    extensions: [".jsx", ".js"],
    modules: [path.basename(__dirname) + "/node_modules"]
  },
};
// first entry takes precedence.
modules: [path.basename(__dirname) + "/node_modules", "node_modules"]
resolve: {
  alias: {
    react: path.resolve("./node_modules/react")
  }
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Webpack 2: How to exclude all node_modules except for


Tag : javascript , By : MrSparky
Date : March 29 2020, 07:55 AM
Does that help I need to have babel run on /node_modules/identicons/ However I still want to exclude all other packages. , I think you can use regex, something like
exclude: [
  /node_modules\/(?!identicons).*/
]

How to exclude many directories of node_modules from parsing for gulp?


Tag : node.js , By : Hans-Inge
Date : March 29 2020, 07:55 AM
I wish this helpful for you I'm not familiar with gulp for automation, but it looks like it allows the globbing syntax. Have you tried something like "!**/node_modules/**/*" ?

webpack how to exclude node_modules except a folder


Tag : webpack , By : k19k
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have to thank Mr. The Bear, he gave me a link with a working solution, and I will answer my question myself for sharing a solution, since very few people read the comments and this may probably would be a question for others. here is the solution:
module: {
    rules: [
      {
        test: /\.js$/, 
        exclude: /node_modules\/(?!(my_main_package\/what_i_need_to_include)\/).*/,
use: {
          loader: 'babel-loader',
          options: options.babelQuery,
        },
      },
...
}

why we need to exclude node_modules in webpack?


Tag : javascript , By : Grace Jones
Date : March 29 2020, 07:55 AM
should help you out
1-Firstly, nearly all packages are written in js not in ts, it is not going to harm if we include node_modules.

Webpack 2 - babel-loader - how to exclude node_modules?


Tag : javascript , By : John R
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com