Created
October 28, 2017 17:50
-
-
Save pablohpsilva/5b736d24327b2631e3b4d88c442d2958 to your computer and use it in GitHub Desktop.
measure5-webpack.prod.conf.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
// ... | |
SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'), | |
loadMinified = require('./load-minified'), | |
// ... | |
module.exports = merge(baseWebpackConfig, { | |
// ... | |
plugins: [ | |
// ... | |
new HtmlWebpackPlugin({ | |
filename: path.resolve(__dirname, '../dist/index.html'), | |
template: 'src/index.html', | |
inject: true, | |
minify: { | |
html5: true, | |
useShortDoctype: true, | |
decodeEntities: true, | |
removeTagWhitespace: true, | |
removeStyleLinkTypeAttributes: true, | |
removeScriptTypeAttributes: true, | |
minifyCSS: true, | |
minifyJS: true, | |
removeComments: true, | |
collapseWhitespace: true, | |
collapseBooleanAttributes: true, | |
removeAttributeQuotes: false, | |
removeRedundantAttributes: true, | |
removeEmptyAttributes: true, | |
preserveLineBreaks: false, | |
sortAttributes: true, | |
sortClassName: true, | |
// more options: | |
// https://github.com/kangax/html-minifier#options-quick-reference | |
}, | |
// necessary to consistently work with multiple chunks via CommonsChunkPlugin | |
chunksSortMode: 'dependency', | |
serviceWorkerLoader: `<script>${loadMinified(path.join(__dirname, | |
'./service-worker-prod.js'))}</script>` | |
}), | |
// ... | |
new SWPrecacheWebpackPlugin({ | |
cacheId: 'toodo-app-v1', | |
filename: 'service-worker.js', | |
staticFileGlobs: ['dist/**/*.{js,json,html,css,json,png,svg,woff}'], | |
minify: true, | |
stripPrefix: 'dist/' | |
}), | |
// ... | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment