build: Enable stylesheet sourceMaps in the development environment (#15113)

This commit is contained in:
Jeffrey Chen 2025-07-12 22:13:33 +08:00 committed by GitHub
parent 13edd338db
commit c59f669092
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 9 deletions

View file

@ -10,7 +10,7 @@ module.exports = (env, argv) => {
return {
mode: argv.mode || "development",
watch: argv.mode !== "production",
devtool: argv.mode !== "production" ? "eval" : false,
devtool: argv.mode !== "production" ? "cheap-source-map" : false,
output: {
publicPath: "auto",
filename: "[name].js",
@ -25,7 +25,10 @@ module.exports = (env, argv) => {
optimization: {
minimize: true,
minimizer: [
new EsbuildPlugin({target: "es6"}),
new EsbuildPlugin({
target: "es6",
sourcemap: argv.mode !== "production",
}),
],
},
resolve: {
@ -44,6 +47,7 @@ module.exports = (env, argv) => {
loader: "esbuild-loader",
options: {
target: "es6",
sourcemap: argv.mode !== "production",
}
},
{
@ -65,9 +69,15 @@ module.exports = (env, argv) => {
MiniCssExtractPlugin.loader,
{
loader: "css-loader", // translates CSS into CommonJS
options: {
sourceMap: argv.mode !== "production",
},
},
{
loader: "sass-loader", // compiles Sass to CSS
options: {
sourceMap: argv.mode !== "production",
},
},
],
},