File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Original file line number Diff line number Diff line change @@ -14,16 +14,19 @@ module.exports = function (content) {
14
14
const loaderContext = this
15
15
const isServer = this . target === 'node'
16
16
const isProduction = this . minimize || process . env . NODE_ENV === 'production'
17
- const options = loaderUtils . getOptions ( this ) || { }
18
17
19
- // shadow mode is an internal option
20
- // enabled via vue-cli's --target web-component
21
- const isShadowMode = ! ! options . shadowMode
18
+ const rawOptions = loaderUtils . getOptions ( this )
22
19
23
20
// share options between the main loader of style/template loaders.
24
21
// to support having multiple uses of vue-loader with different options,
25
22
// we cache and retrieve options for each unique options object.
26
- const optionsId = saveOptions ( options )
23
+ const optionsId = saveOptions ( rawOptions )
24
+
25
+ const options = rawOptions || { }
26
+
27
+ // shadow mode is an internal option
28
+ // enabled via vue-cli's --target web-component
29
+ const isShadowMode = ! ! options . shadowMode
27
30
28
31
const filePath = this . resourcePath
29
32
const fileName = path . basename ( filePath )
Original file line number Diff line number Diff line change @@ -32,14 +32,14 @@ exports.saveOptions = options => {
32
32
return optionsToId . get ( options )
33
33
}
34
34
35
- const threadMode = options . threadMode
35
+ const threadMode = options && options . threadMode
36
36
const serialized = threadMode ? serialize ( options ) : null
37
37
const id = serialized ? hash ( serialized ) : String ( idToOptions . size )
38
38
39
- idToOptions . set ( id , options )
39
+ idToOptions . set ( id , options || { } )
40
40
optionsToId . set ( options , id )
41
41
42
- if ( serialized ) {
42
+ if ( options && serialized ) {
43
43
const fsidToOptionsPath = getidToOptionsPath ( id )
44
44
if ( ! fs . existsSync ( fsidToOptionsPath ) ) {
45
45
fs . writeFileSync ( fsidToOptionsPath , serialized )
You can’t perform that action at this time.
0 commit comments