Browse Source

build(webpack): attach sourcemaps so it helps in debugging

Aakansha Doshi 4 years ago
parent
commit
ec6999554a
1 changed files with 14 additions and 1 deletions
  1. 14 1
      src/packages/excalidraw/webpack.prod.config.js

+ 14 - 1
src/packages/excalidraw/webpack.prod.config.js

@@ -2,6 +2,7 @@ const path = require("path");
 const TerserPlugin = require("terser-webpack-plugin");
 const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
   .BundleAnalyzerPlugin;
+const webpack = require("webpack");
 
 module.exports = {
   mode: "production",
@@ -24,7 +25,16 @@ module.exports = {
       {
         test: /\.(sa|sc|c)ss$/,
         exclude: /node_modules/,
-        use: ["style-loader", { loader: "css-loader" }, "sass-loader"],
+        use: [
+          "style-loader",
+          {
+            loader: "css-loader",
+            options: {
+              sourceMap: false,
+            },
+          },
+          "sass-loader",
+        ],
       },
       {
         test: /\.(ts|tsx|js|jsx|mjs)$/,
@@ -89,6 +99,9 @@ module.exports = {
   },
   plugins: [
     ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []),
+    new webpack.SourceMapDevToolPlugin({
+      filename: "[name].js.map",
+    }),
   ],
   externals: {
     react: {