more build options
This commit is contained in:
parent
e0e3b70e78
commit
c92290bdd9
6453
package-lock.json
generated
Normal file
6453
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@
|
|||||||
"jsdom": "^15.2.1",
|
"jsdom": "^15.2.1",
|
||||||
"prerender-spa-plugin": "^3.4.0",
|
"prerender-spa-plugin": "^3.4.0",
|
||||||
"tempy": "^0.3.0",
|
"tempy": "^0.3.0",
|
||||||
|
"terser-webpack-plugin": "^2.3.0",
|
||||||
"webpack": "^4.41.2",
|
"webpack": "^4.41.2",
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.10",
|
||||||
"workbox-webpack-plugin": "^4.3.1"
|
"workbox-webpack-plugin": "^4.3.1"
|
||||||
@ -19,4 +20,4 @@
|
|||||||
"author": "notgne2",
|
"author": "notgne2",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const TerserPlugin = require('terser-webpack-plugin')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
||||||
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
|
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
|
||||||
@ -16,6 +17,16 @@ const magicFile = (text) => {
|
|||||||
|
|
||||||
// const magicAppend = (orig, text, sep = '\n') => magicFile(fs.readFileSync(orig) + sep + text)
|
// const magicAppend = (orig, text, sep = '\n') => magicFile(fs.readFileSync(orig) + sep + text)
|
||||||
|
|
||||||
|
const jsMin = {
|
||||||
|
pure_funcs: ["F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9"],
|
||||||
|
pure_getters: true,
|
||||||
|
keep_fargs: false,
|
||||||
|
unsafe_comps: true,
|
||||||
|
unsafe: true,
|
||||||
|
compress: true,
|
||||||
|
mangle: true,
|
||||||
|
}
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
{
|
{
|
||||||
module: {
|
module: {
|
||||||
@ -26,15 +37,34 @@ module.exports =
|
|||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin(),
|
new TerserPlugin({
|
||||||
|
terserOptions: jsMin,
|
||||||
|
}),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
hash: true,
|
||||||
|
meta: {
|
||||||
|
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'
|
||||||
|
}
|
||||||
|
}),
|
||||||
new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]),
|
new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]),
|
||||||
new PrerenderSPAPlugin({
|
new PrerenderSPAPlugin({
|
||||||
staticDir: path.join(__dirname, 'dist'),
|
staticDir: path.join(__dirname, 'dist'),
|
||||||
routes: ROUTES,
|
routes: ROUTES,
|
||||||
minify: {
|
minify: {
|
||||||
minifyCSS: true,
|
minifyCSS: {
|
||||||
minifyJS: true,
|
compatibility: 'ie9',
|
||||||
|
level: 2
|
||||||
|
},
|
||||||
|
minifyJS: jsMin,
|
||||||
removeComments: true,
|
removeComments: true,
|
||||||
|
collapseBooleanAttributes: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
collapseInlineTagWhitespace: true,
|
||||||
|
removeRedundantAttributes: true,
|
||||||
|
removeScriptTypeAttributes: true,
|
||||||
|
removeStyleLinkTypeAttributes: true,
|
||||||
|
sortAttributes: true,
|
||||||
|
sortClassName: true,
|
||||||
},
|
},
|
||||||
renderer: new Renderer(),
|
renderer: new Renderer(),
|
||||||
postProcess(renderedRoute) {
|
postProcess(renderedRoute) {
|
||||||
|
Loading…
Reference in New Issue
Block a user