Skip to content

Commit 5417db9

Browse files
committed
feat(service): env variables in html template
1 parent 5968e5a commit 5417db9

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VUE_APP_TITLE=Vue3 Mobile
1+
VUE_APP_TITLE=Vue3 Boilerplate

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<meta charset="utf-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
7-
<title>Vue3 boilerplate</title>
7+
<link rel="icon" href="<%= PUBLIC_PATH %>favicon.ico" />
8+
<title><%= VUE_APP_TITLE %></title>
89
</head>
910
<body>
1011
<div id="app"></div>

service/config/base.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ module.exports = {
4747
new CaseSensitivePathsPlugin(),
4848
new HTMLPlugin({
4949
template: paths.resolve('public/index.html'),
50+
templateParameters: {
51+
...resolveClientEnv(
52+
{ publicPath: isProd ? config.build.publicPath : config.dev.publicPath },
53+
true /* raw */
54+
),
55+
},
5056
}),
5157
new CopyPlugin({
5258
patterns: [
@@ -65,7 +71,9 @@ module.exports = {
6571
__VUE_OPTIONS_API__: 'true',
6672
__VUE_PROD_DEVTOOLS__: 'false',
6773

68-
...resolveClientEnv({ publicPath: config.dev.publicPath }),
74+
...resolveClientEnv({
75+
publicPath: isProd ? config.build.publicPath : config.dev.publicPath,
76+
}),
6977
}),
7078
],
7179

0 commit comments

Comments
 (0)