File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
28
28
// Webpack uses `publicPath` to determine where the app is being served from.
29
29
// It requires a trailing slash, or the file assets will get an incorrect path.
30
30
const publicPath = paths . servedPath ;
31
+ // Some apps do not use client-side routing with pushState.
32
+ // For these, "homepage" can be set to "." to enable relative asset paths.
33
+ const shouldUseRelativeAssetPaths = publicPath === './' ;
31
34
// Source maps are resource heavy and can cause out of memory issue for large source files.
32
35
const shouldUseSourceMap = process . env . GENERATE_SOURCEMAP !== 'false' ;
33
36
// `publicUrl` is just like `publicPath`, but we will provide it to our app
@@ -52,7 +55,13 @@ const sassModuleRegex = /\.module\.(scss|sass)$/;
52
55
// common function to get style loaders
53
56
const getStyleLoaders = ( cssOptions , preProcessor ) => {
54
57
const loaders = [
55
- MiniCssExtractPlugin . loader ,
58
+ {
59
+ loader : MiniCssExtractPlugin . loader ,
60
+ options : Object . assign (
61
+ { } ,
62
+ shouldUseRelativeAssetPaths ? { publicPath : '../../' } : undefined
63
+ ) ,
64
+ } ,
56
65
{
57
66
loader : require . resolve ( 'css-loader' ) ,
58
67
options : cssOptions ,
You can’t perform that action at this time.
0 commit comments