Webpack: generate 404.html during build
This commit is contained in:
parent
402a45b495
commit
bba6716cf7
2 changed files with 18 additions and 16 deletions
|
@ -88,7 +88,6 @@ pages:
|
||||||
script:
|
script:
|
||||||
- yarn build
|
- yarn build
|
||||||
- mv static public
|
- mv static public
|
||||||
- cp public/{index.html,404.html}
|
|
||||||
variables:
|
variables:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
artifacts:
|
artifacts:
|
||||||
|
|
|
@ -11,6 +11,21 @@ const { UnusedFilesWebpackPlugin } = require('unused-files-webpack-plugin');
|
||||||
const { env, settings, output } = require('./configuration');
|
const { env, settings, output } = require('./configuration');
|
||||||
const rules = require('./rules');
|
const rules = require('./rules');
|
||||||
|
|
||||||
|
const htmlWebpackPluginConfig = {
|
||||||
|
template: 'app/index.ejs',
|
||||||
|
chunksSortMode: 'manual',
|
||||||
|
chunks: ['common', 'locale_en', 'application', 'styles'],
|
||||||
|
alwaysWriteToDisk: true,
|
||||||
|
minify: {
|
||||||
|
collapseWhitespace: true,
|
||||||
|
removeComments: false,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
removeScriptTypeAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
useShortDoctype: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: Object.assign(
|
entry: Object.assign(
|
||||||
{ application: resolve('app/application.js') },
|
{ application: resolve('app/application.js') },
|
||||||
|
@ -75,21 +90,9 @@ module.exports = {
|
||||||
ignore: ['node_modules/**/*', '**/__*__/**/*'],
|
ignore: ['node_modules/**/*', '**/__*__/**/*'],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
// https://github.com/ampedandwired/html-webpack-plugin
|
// https://github.com/jantimon/html-webpack-plugin#options
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin(htmlWebpackPluginConfig),
|
||||||
template: 'app/index.ejs',
|
new HtmlWebpackPlugin(Object.assign(htmlWebpackPluginConfig, { filename: '404.html' })),
|
||||||
chunksSortMode: 'manual',
|
|
||||||
chunks: ['common', 'locale_en', 'application', 'styles'],
|
|
||||||
alwaysWriteToDisk: true,
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeComments: false,
|
|
||||||
removeRedundantAttributes: true,
|
|
||||||
removeScriptTypeAttributes: true,
|
|
||||||
removeStyleLinkTypeAttributes: true,
|
|
||||||
useShortDoctype: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new HtmlWebpackHarddiskPlugin(),
|
new HtmlWebpackHarddiskPlugin(),
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [{
|
patterns: [{
|
||||||
|
|
Loading…
Reference in a new issue