File tree 1 file changed +10
-6
lines changed
packages/@vue/cli-service/lib/config
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
const fs = require ( 'fs' )
2
2
const path = require ( 'path' )
3
+ const isAbsoluteUrl = require ( '../util/isAbsoluteUrl' )
3
4
4
5
const findExisting = ( context , files ) => {
5
6
for ( const file of files ) {
@@ -39,16 +40,19 @@ module.exports = (api, rootOptions) => {
39
40
chunkFilename : filename
40
41
} , extract && typeof extract === 'object' ? extract : { } )
41
42
43
+ // when project publicPath is a relative path
42
44
// use relative publicPath in extracted CSS based on extract location
43
- const cssPublicPath = process . env . VUE_CLI_BUILD_TARGET === 'lib'
44
- // in lib mode, CSS is extracted to dist root.
45
- ? './'
46
- : '../' . repeat (
47
- extractOptions . filename
45
+ const cssPublicPath = ( isAbsoluteUrl ( rootOptions . publicPath ) || rootOptions . publicPath . startsWith ( '/' ) )
46
+ ? rootOptions . publicPath
47
+ : process . env . VUE_CLI_BUILD_TARGET === 'lib'
48
+ // in lib mode, CSS is extracted to dist root.
49
+ ? './'
50
+ : '../' . repeat (
51
+ extractOptions . filename
48
52
. replace ( / ^ \. [ / \\ ] / , '' )
49
53
. split ( / [ / \\ ] / g)
50
54
. length - 1
51
- )
55
+ )
52
56
53
57
// check if the project has a valid postcss config
54
58
// if it doesn't, don't use postcss-loader for direct style imports
You can’t perform that action at this time.
0 commit comments