F
F
feelsgood2017-03-31 00:34:28
JavaScript
feelsgood, 2017-03-31 00:34:28

How to exclude modules from sourcemap in webpack 2?

Hello.
The project uses webpack 2 which bundles .js. Sourcemaps are generated during assembly:

// webpack.config.js

{
  ...
  devtool: 'source-map',
  ...
  plugins: [
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true
    })
  ],
  ...
}

The project also uses N-number of libraries, which are compiled into one bundle with the rest of the project scripts. The question is: is it possible (and is it possible at all?) to exclude some libraries from sourcemaps? Something like:
new webpack.optimize.UglifyJsPlugin({
  sourceMap: true
  sourceMapExclude: ['jquery', 'react', 'lodash', 'backbone']
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-03-31
@werty1001

Try:

new webpack.SourceMapDevToolPlugin({
  filename: "[file].map",
  exclude: ["vendors.js"]
})

instead ofdevtool: 'source-map',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question