Browse Source

Use a javascript source map for production builds

This will allow the user to see the original file name and the source
code line number in the case of a Javascript error when using browser's
developer tools.

Note that the full source code can also be enabled in the developer
tools if needed by changing `nosources-source-map` to `source-map` in
`webpack.config` before building.
Sergiu Miclea 7 years ago
parent
commit
3fbf97f0d6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      webpack.config.js

+ 6 - 1
webpack.config.js

@@ -109,8 +109,13 @@ const config = createConfig([
       app: sourcePath,
     }),
     splitVendor(),
+    () => ({ devtool: 'nosources-source-map' }),
     addPlugins([
-      new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, mangle: { keep_fnames: true } }),
+      new webpack.optimize.UglifyJsPlugin({
+        compress: { warnings: false },
+        mangle: { keep_fnames: true },
+        sourceMap: true,
+      }),
     ]),
   ]),
 ])