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

aakansha-sm
Aakansha Doshi 4 years ago
parent 3922ee8c11
commit ec6999554a

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

Loading…
Cancel
Save