Skip to content

Commit

Permalink
feat: use a different html file so spa serve still works
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Oct 20, 2019
1 parent bdaa981 commit f9d4093
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = (api, options) => {

return {
distPath: api.resolve(outputPath),
templatePath: api.resolve(`${outputPath}/index.html`),
templatePath: api.resolve(`${outputPath}/index.ssr.html`),
serviceWorkerPath: api.resolve(`${outputPath}/service-worker.js`),
}
}
9 changes: 9 additions & 0 deletions lib/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ exports.chainWebpack = (webpackConfig) => {
})
}

const htmlPlugin = webpackConfig.plugins.get('html').store
webpackConfig.plugin('html-ssr').use(htmlPlugin.get('plugin'), [
{
...htmlPlugin.get('args')[0],
template: config.api.resolve('public/index.ssr.html'),
filename: 'index.ssr.html',
},
])

webpackConfig.entry('app').clear().add(config.entry(target))

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

0 comments on commit f9d4093

Please sign in to comment.