File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed 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) {
1414 const loaderContext = this
1515 const isServer = this . target === 'node'
1616 const isProduction = this . minimize || process . env . NODE_ENV === 'production'
17- const options = loaderUtils . getOptions ( this ) || { }
1817
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 )
2219
2320 // share options between the main loader of style/template loaders.
2421 // to support having multiple uses of vue-loader with different options,
2522 // 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
2730
2831 const filePath = this . resourcePath
2932 const fileName = path . basename ( filePath )
Original file line number Diff line number Diff line change @@ -32,14 +32,14 @@ exports.saveOptions = options => {
3232 return optionsToId . get ( options )
3333 }
3434
35- const threadMode = options . threadMode
35+ const threadMode = options && options . threadMode
3636 const serialized = threadMode ? serialize ( options ) : null
3737 const id = serialized ? hash ( serialized ) : String ( idToOptions . size )
3838
39- idToOptions . set ( id , options )
39+ idToOptions . set ( id , options || { } )
4040 optionsToId . set ( options , id )
4141
42- if ( serialized ) {
42+ if ( options && serialized ) {
4343 const fsidToOptionsPath = getidToOptionsPath ( id )
4444 if ( ! fs . existsSync ( fsidToOptionsPath ) ) {
4545 fs . writeFileSync ( fsidToOptionsPath , serialized )
You can’t perform that action at this time.
0 commit comments