Skip to content

Commit 914c95e

Browse files
Andrew Lucaianschmitz
Andrew Luca
authored andcommitted
Resolve relative paths for preprocessor styles (#5829)
preprocessor will output sourceMap by default then check if sourceMaps are needed on resolve-url-loader Fixes #4653
1 parent 066053c commit 914c95e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

packages/react-scripts/config/webpack.config.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,20 @@ module.exports = function(webpackEnv) {
124124
},
125125
].filter(Boolean);
126126
if (preProcessor) {
127-
loaders.push({
128-
loader: require.resolve(preProcessor),
129-
options: {
130-
sourceMap: isEnvProduction && shouldUseSourceMap,
127+
loaders.push(
128+
{
129+
loader: require.resolve('resolve-url-loader'),
130+
options: {
131+
sourceMap: isEnvProduction && shouldUseSourceMap,
132+
},
131133
},
132-
});
134+
{
135+
loader: require.resolve(preProcessor),
136+
options: {
137+
sourceMap: true,
138+
},
139+
}
140+
);
133141
}
134142
return loaders;
135143
};

packages/react-scripts/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"react-app-polyfill": "^1.0.1",
7171
"react-dev-utils": "^9.0.1",
7272
"resolve": "1.10.0",
73+
"resolve-url-loader": "3.0.1",
7374
"sass-loader": "7.1.0",
7475
"semver": "6.0.0",
7576
"style-loader": "0.23.1",

0 commit comments

Comments
 (0)