Skip to content

Commit

Permalink
Configure webpack asset and entry point size limits
Browse files Browse the repository at this point in the history
https://webpack.js.org/configuration/performance/

Run webpack with prod config in Travis to avoid regressions.
  • Loading branch information
foolip authored and Hexcles committed May 27, 2019
1 parent c6adcfc commit 29d8505
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ language: node_js

matrix:
include:
- name: node10
- name: lint
node_js: 10
script:
- npm run lint
# Run webpack to check size limits.
- npx webpack --config config/webpack.prod.js
after_script:
- true # don't run codecov

- name: node10
node_js: 10
script:
- npm run coverageNode

- name: node12
node_js: 12
script:
- npm run lint
- npm run coverageNode

- name: chrome
Expand Down
8 changes: 8 additions & 0 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ module.exports = merge(common, {
}),
],
},
performance: {
// These size limits are *much* larger than webpack's default
// recommendation of 250kb, but are combined with 'error' to ensure that
// they don't grow accidentally beyond the current size.
hints: 'error',
maxAssetSize: 1.5*1024*1024,
maxEntrypointSize: 2.2*1024*1024,
},
});

0 comments on commit 29d8505

Please sign in to comment.