Webpack 3.0:如何从构建中排除node_modules?

时间:2018-02-21 04:41:34

标签: angularjs webpack webpack-2 webpack-3

我尝试添加' target:node'到webpack.dev.js从我的bundle文件中排除node_modules。这会导致错误。现在我的目标是:网络'但是又返回了node_modules。这是我的applicationpart的配置文件(试图使用DllReferencePlugin):

<handlers>
  <add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>

如何从ha.js(app bundle)构建中排除node_modules文件夹?有关完整代码,请参阅here

1 个答案:

答案 0 :(得分:0)

Here一个例子:

 rules: [
    {
      test: /\.js$/,
      exclude: /(node_modules)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['@babel/preset-env']
        }
      }
    }
  ]