Webpack Exclude folder

Viewed 9344

I'm shoving a rather large app through Webpack, which pulls from two library folders: thirdparty and node_modules. I've setup my rule for js files as such:

{
    test: /\.js$/,
    loader: 'babel-loader',
    include: [
      /src\/js\/client/
    ],
    exclude: [
      /node_modules/,
      /thirdparty/
    ]
  }

My hope was that webpack wouldn't parse any folders under either of those two directories, but I'm getting errors for libraries that are. For instance:

WARNING in ./~/durandal/js/system.js
51:8-15 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/durandal/js/system.js
52:8-15 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./~/durandal/js/system.js
Cannot statically analyse 'require(..., ...)' in line 278
 @ ./src/js/client/lib/durandal/overrides/views.js 2:0-37
 @ ./src/js/client/index.js

Am I misunderstanding the functionality of include/exclude, or is this a bug with Webpack?

1 Answers
Related