Skip to content

Commit 27e5c6b

Browse files
committed
fix: 变量 libName 是中横线字符,demo 页面读取时报错。
1 parent f0f254e commit 27e5c6b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/@vue/cli-service/lib/commands/build/demo-lib-js.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<% } %>
88

99
<script>
10-
console.log(<%- htmlWebpackPlugin.options.libName %>)
10+
console.log(globalThis['<%- htmlWebpackPlugin.options.libName %>'])
1111
</script>

packages/@vue/cli-service/lib/commands/build/demo-lib.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
<% if (htmlWebpackPlugin.options.vueMajor === 3) { %>
1616
Vue.createApp({
1717
components: {
18-
demo: <%- htmlWebpackPlugin.options.libName %>
18+
demo: globalThis['<%- htmlWebpackPlugin.options.libName %>']
1919
}
2020
}).mount('#app')
2121
<% } else { %>
2222
new Vue({
2323
components: {
24-
demo: <%- htmlWebpackPlugin.options.libName %>
24+
demo: globalThis['<%- htmlWebpackPlugin.options.libName %>']
2525
}
2626
}).$mount('#app')
2727
<% } %>

0 commit comments

Comments
 (0)