Skip to content

Commit e7ca345

Browse files
committed
fix(app-vite): possible HTML syntax error when injecting publicPath
1 parent ef41d24 commit e7ca345

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app-vite/lib/config-tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ function createViteConfig (quasarConf, quasarRunMode) {
103103
logLevel: 'warn',
104104
mode: ctx.dev === true ? 'development' : 'production',
105105
cacheDir,
106+
define: parseEnv(build.env, build.rawDefine),
106107

107108
resolve: {
108109
alias: build.alias
109110
},
110-
define: parseEnv(build.env, build.rawDefine),
111111

112112
build: {
113113
target: quasarRunMode === 'ssr-server'

app-vite/lib/helpers/html-template.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const minifyOptions = {
1919

2020
function injectPublicPath (html, publicPath) {
2121
return html.replace(
22-
/(href|src)\s*=\s*['"](.+)['"]/ig,
23-
(_, att, val) => absoluteUrlRE.test(val.trim()) === true
24-
? `${att}=${val}`
25-
: `${att}=${publicPath + val}`
22+
/(href|src)\s*=\s*(['"])(.+)(['"])/ig,
23+
(_, att, pre, val, post) => absoluteUrlRE.test(val.trim()) === true
24+
? `${att}=${pre}${val}${post}`
25+
: `${att}=${pre}${publicPath + val}${post}`
2626
)
2727
}
2828

0 commit comments

Comments
 (0)