Skip to content

Commit 9029ad1

Browse files
houfeng0923haoqunjiang
authored andcommittedJan 28, 2019
fix: do not add link tag to demo page when css extract is false (#3351)
1 parent ab13dfe commit 9029ad1

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed
 

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

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<meta charset="utf-8">
22
<title><%- htmlWebpackPlugin.options.libName %> demo</title>
33
<script src="./<%- htmlWebpackPlugin.options.libName %>.umd.js"></script>
4+
<% if (htmlWebpackPlugin.options.cssExtract) { %>
45
<link rel="stylesheet" href="./<%- htmlWebpackPlugin.options.libName %>.css">
6+
<% } %>
57

68
<script>
79
console.log(<%- htmlWebpackPlugin.options.libName %>)

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

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<title><%- htmlWebpackPlugin.options.libName %> demo</title>
33
<script src="https://unpkg.com/vue"></script>
44
<script src="./<%- htmlWebpackPlugin.options.libName %>.umd.js"></script>
5+
<% if (htmlWebpackPlugin.options.cssExtract) { %>
56
<link rel="stylesheet" href="./<%- htmlWebpackPlugin.options.libName %>.css">
7+
<% } %>
68

79
<div id="app">
810
<demo></demo>

‎packages/@vue/cli-service/lib/commands/build/resolveLibConfig.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ module.exports = (api, { entry, name, formats }, options) => {
6363
template: path.resolve(__dirname, template),
6464
inject: false,
6565
filename: 'demo.html',
66-
libName
66+
libName,
67+
cssExtract: config.plugins.has('extract-css')
6768
}])
6869
}
6970

0 commit comments

Comments
 (0)
Please sign in to comment.