Skip to content

Commit 7d3a4e3

Browse files
refactor: remove logical operators from runtime
handle logic operator at compiler level
1 parent 97bbfc9 commit 7d3a4e3

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ class MiniCssExtractPlugin {
377377
'}',
378378
])
379379
: '',
380-
`var insert = ${insert};`,
381-
`if (insert) { insert(linkTag); }`,
382-
`else {var head = document.getElementsByTagName("head")[0]; head.appendChild(linkTag);} `,
380+
insert
381+
? 'insert(linkTag);'
382+
: 'var head = document.getElementsByTagName("head")[0]; head.appendChild(linkTag)',
383383
]),
384384
'}).then(function() {',
385385
Template.indent(['installedCssChunks[chunkId] = 0;']),

src/plugin-options.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
},
1717
"insert": {
1818
"description": "Inserts `<link>` at the given position (https://github.com/faceyspacey/extract-css-chunks-webpack-pluginn#insert).",
19-
"anyOf": [
20-
{
21-
"type": "string"
22-
},
23-
{
24-
"instanceof": "Function"
25-
}
26-
]
19+
"instanceof": "Function"
2720
}
2821
}
2922
}

0 commit comments

Comments
 (0)