Thursday, 1 June 2017

Generating source maps with webpack2?

I'm a little confused about how source maps should be generated in webpack2 (e.g. for production builds). Reason is, there seem to be several approaches and many examples I've seen either use one or the other, or all of them. For instance:

There's a way to generate source maps using the devtool property on the webpack.config.js object, by declaring e.g: devtool: isProduction ? 'source-map' : false (which itself uses SourceMapDevToolPlugin).

Then, many loaders (css-loader, sass-loader, ts-loader) have their own source maps property in their options:

loader: 'css-loader'
options: {
  sourceMap: isProduction
})

Additionally, there's a way to declare source maps generation using the V1 compatibility plugin LoaderOptionsPlugin, or a source-maps-loader extension.

Some projects rely only on devtool (AngularClass/angular-starter), while others use several methods ([mrholek/CoreUI-Free-Bootstrap-Admin-Template](



via null null

No comments:

Post a Comment