Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

adding css to sourceMap config #1042

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/slate-tools/tools/webpack/config/parts/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const config = new SlateConfig(require('../../../../slate-tools.schema'));

const isDev = process.env.NODE_ENV === 'development';

if (config.get('webpack.sourceMap.styles')) {
console.info("Enabling sourcemaps in styles when using HMR causes style-loader to inject styles using a <link> tag instead of <style> tag. This causes a FOUC content, which can cause issues with JS that is reading the DOM for styles (width, height, visibility) on page load.")
}

const part = {
module: {
rules: [],
Expand All @@ -28,14 +32,14 @@ const cssLoader = {
// styles using a <link> tag instead of <style> tag. This causes
// a FOUC content, which can cause issues with JS that is reading
// the DOM for styles (width, height, visibility) on page load.
options: {sourceMap: !isDev},
options: {sourceMap: config.get('webpack.sourceMap.styles')},
};

const postcssLoader = {
loader: 'postcss-loader',
options: {
ident: 'postcss',
sourceMap: !isDev,
sourceMap: config.get('webpack.sourceMap.styles'),
plugins: config.get('webpack.postcss.plugins'),
},
};
Expand Down