Skip to content

Commit f9d4093

Browse files
author
Guillaume Chau
committed
feat: use a different html file so spa serve still works
1 parent bdaa981 commit f9d4093

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lib/default-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = (api, options) => {
33

44
return {
55
distPath: api.resolve(outputPath),
6-
templatePath: api.resolve(`${outputPath}/index.html`),
6+
templatePath: api.resolve(`${outputPath}/index.ssr.html`),
77
serviceWorkerPath: api.resolve(`${outputPath}/service-worker.js`),
88
}
99
}

lib/webpack.js

+9
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ exports.chainWebpack = (webpackConfig) => {
5050
})
5151
}
5252

53+
const htmlPlugin = webpackConfig.plugins.get('html').store
54+
webpackConfig.plugin('html-ssr').use(htmlPlugin.get('plugin'), [
55+
{
56+
...htmlPlugin.get('args')[0],
57+
template: config.api.resolve('public/index.ssr.html'),
58+
filename: 'index.ssr.html',
59+
},
60+
])
61+
5362
webpackConfig.entry('app').clear().add(config.entry(target))
5463

5564
webpackConfig.plugin('define').tap(args => {

0 commit comments

Comments
 (0)