Optimize vendor code

This commit is contained in:
Rico Sta. Cruz 2017-10-04 10:17:32 +08:00
parent 28fc21c90e
commit 376be2ae0d
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
4 changed files with 47 additions and 31 deletions

View File

@ -2,6 +2,7 @@
{% include polyfills.html %} {% include polyfills.html %}
<!-- script --> <!-- script -->
<script src='{{base}}/assets/packed/vendor.js?t={{ timestamp }}'></script>
<script src='{{base}}/assets/packed/app.js?t={{ timestamp }}'></script> <script src='{{base}}/assets/packed/app.js?t={{ timestamp }}'></script>
<!-- 3rd-party libs --> <!-- 3rd-party libs -->

View File

@ -5,7 +5,11 @@ const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
module.exports = { module.exports = {
context: join(__dirname, '..'), context: join(__dirname, '..'),
entry: { entry: {
app: './_js/app.js' app: './_js/app.js',
vendor: [
'jquery',
'prismjs'
]
}, },
output: { output: {
path: join(__dirname, '..', 'assets', 'packed'), path: join(__dirname, '..', 'assets', 'packed'),
@ -31,6 +35,16 @@ module.exports = {
}, },
stats: 'minimal', stats: 'minimal',
plugins: [ plugins: [
// Optimize module ID's for vendor chunks
new webpack.HashedModuleIdsPlugin({
hashFunction: 'sha256',
hashDigest: 'base64',
hashDigestLength: 20
}),
// Optimize vendor
new webpack.optimize.CommonsChunkPlugin('vendor'),
// Don't include debug symbols ever // Don't include debug symbols ever
new webpack.EnvironmentPlugin({ new webpack.EnvironmentPlugin({
NODE_ENV: 'production' NODE_ENV: 'production'

File diff suppressed because one or more lines are too long

24
assets/packed/vendor.js Normal file

File diff suppressed because one or more lines are too long