Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc83157

Browse filesBrowse files
committed
test: fix test for duplication style injection
1 parent 0b36a2c commit fc83157
Copy full SHA for fc83157

File tree

Expand file treeCollapse file tree

2 files changed

+11
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-8
lines changed

‎lib/loader.js

Copy file name to clipboardExpand all lines: lib/loader.js
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff 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)

‎lib/utils/options-cache.js

Copy file name to clipboardExpand all lines: lib/utils/options-cache.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.