Disable inject option of HTML plugin

This commit is contained in:
Boris Kubiak 2018-09-17 22:26:33 +02:00
parent 39ea5f492d
commit 13cc056e51

View file

@ -7,14 +7,13 @@ const PrerenderSpaPlugin = require('prerender-spa-plugin');
const SriPlugin = require('webpack-subresource-integrity'); const SriPlugin = require('webpack-subresource-integrity');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = { module.exports = {
entry: { entry: {
index: './src/main.js' index: './src/main.js'
}, },
output: { output: {
crossOriginLoading: 'anonymous', crossOriginLoading: 'anonymous',
path: path.resolve(__dirname, './dist'), path: path.resolve(__dirname, './dist'),
publicPath: '/dist/', publicPath: '/dist/',
filename: '[name].js' filename: '[name].js'
}, },
@ -84,22 +83,23 @@ if (process.env.NODE_ENV === 'production') {
warnings: false warnings: false
} }
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'index.html', template: 'index.html',
filename: '../index.html', filename: '../index.html',
}), inject: false
new SriPlugin({ }),
hashFuncNames: ['sha256', 'sha384'], new SriPlugin({
}), hashFuncNames: ['sha256', 'sha384']
}),
new PrerenderSpaPlugin({ new PrerenderSpaPlugin({
staticDir: path.join(__dirname), staticDir: path.join(__dirname),
routes: ['/'], routes: ['/'],
postProcess (renderedRoute) { postProcess(renderedRoute) {
renderedRoute.html = pretty(renderedRoute.html, {ocd: true}) renderedRoute.html = pretty(renderedRoute.html, {ocd: true})
.replace('render', 'prerender') .replace('render', 'prerender')
.replace(/(data-v-[0-9a-f]+)=""/gm, '$1'); .replace(/(data-v-[0-9a-f]+)=""/gm, '$1');
return renderedRoute return renderedRoute;
}, }
}) })
]); ]);
} }