You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/config/path-util.js
+12-7Lines changed: 12 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ const path = require('path');
13
13
14
14
module.exports={
15
15
/**
16
-
* Determines the "contentBase" used for the devServer.
16
+
* Determines the "contentBase" to use for the devServer.
17
17
*
18
18
* @param {WebpackConfig} webpackConfig
19
19
* @return {String}
@@ -30,6 +30,10 @@ module.exports = {
30
30
* * outputPath = /var/www/public/build
31
31
* * publicPath = /build/
32
32
* => contentBase should be /var/www/public
33
+
*
34
+
* At this point, if the publicPath is non-standard (e.g. it contains
35
+
* a sub-directory or is absolute), then the user will already see
36
+
* an error that they must set the manifestKeyPrefix.
33
37
*/
34
38
35
39
// start with outputPath, then join publicPath with it, see if it equals outputPath
@@ -44,7 +48,7 @@ module.exports = {
44
48
}
45
49
}
46
50
47
-
thrownewError(`Unable to determine contentBase option for webpack's devServer configuration. The publicPath (${webpackConfig.publicPath}) string does not exist in the outputPath (${webpackConfig.outputPath}), and so the "document root" cannot be determined.`);
51
+
thrownewError(`Unable to determine contentBase option for webpack's devServer configuration. The ${webpackConfig.manifestKeyPrefix ? 'manifestKeyPrefix' : 'publicPath'} (${webpackConfig.manifestKeyPrefix ? webpackConfig.manifestKeyPrefix : webpackConfig.publicPath}) string does not exist in the outputPath (${webpackConfig.outputPath}), and so the "document root" cannot be determined.`);
48
52
},
49
53
50
54
/**
@@ -64,9 +68,13 @@ module.exports = {
64
68
* ok to use the publicPath as the manifestKeyPrefix.
// nothing to check - they have manually set the key prefix
75
+
return;
76
+
}
77
+
70
78
if(webpackConfig.publicPath.includes('://')){
71
79
/*
72
80
* If publicPath is absolute, you probably don't want your manifests.json
@@ -103,8 +111,5 @@ module.exports = {
103
111
104
112
thrownewError(`Cannot determine how to prefix the keys in manifest.json. Call Encore.setManifestKeyPrefix() to choose what path (e.g. ${suggestion}) to use when building your manifest keys. This is caused by setOutputPath() (${outputPath}) and setPublicPath() (${publicPath}) containing paths that don't seem compatible.`);
105
113
}
106
-
107
-
// by convention, we remove the opening slash on the manifest keys
0 commit comments