Skip to content

Commit

Permalink
Fix SASS source maps to embed source text
Browse files Browse the repository at this point in the history
Previously, the source maps were created, but the original source code wasn't embedded. This left browsers to fetch `webpack://` URLs, which weren't resolvable.
  • Loading branch information
MrSerth authored and Dome-GER committed Sep 30, 2024
1 parent 1a4b981 commit efc1d24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ if (webpackConfig.mode === 'development') {
envConfig.devtool = 'source-map';
}

// Enable source map for SASS / SCSS files, including the original sources in the source map.
webpackConfig.module.rules
.flatMap(rule => Array.isArray(rule.use) ? rule.use : [])
.filter(loaderConfig => loaderConfig.options?.sassOptions)
.forEach(loaderConfig => loaderConfig.options.sassOptions.sourceMapIncludeSources = true);

// Use the following lines below to remove original plugins and replace them with our custom config.
// This is especially needed for the `WebpackAssetsManifest` plugin, which would otherwise run twice.
const customPlugins = envConfig.plugins.map((plugin) => plugin.constructor.name);
Expand Down

0 comments on commit efc1d24

Please sign in to comment.