Merge pull request #103 from ai/size-limit

Add package size profiling tools
release
Etienne Lemay 2017-08-17 10:33:41 -04:00 committed by GitHub
commit 191f97084c
5 changed files with 2104 additions and 54 deletions

View File

@ -1,2 +1,3 @@
dist/report.html
scripts/
.*

View File

@ -62,7 +62,7 @@ module.exports = function(config) {
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous

View File

@ -47,8 +47,10 @@
"react": "^15.5.4",
"react-dom": "^15.5.4",
"rimraf": "2.5.2",
"size-limit": "^0.10.0",
"svg-jsx-loader": "^0.0.16",
"webpack": "1.12.14"
"webpack": "1.12.14",
"webpack-bundle-analyzer": "^2.9.0"
},
"scripts": {
"clean": "rimraf data/ dist/",
@ -61,7 +63,13 @@
"react:clean": "rimraf node_modules/{react,react-dom,react-addons-test-utils}",
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev",
"test": "NODE_ENV=test ./node_modules/karma/bin/karma start",
"test": "NODE_ENV=test karma start && size-limit",
"prepublish": "npm run clean && npm run build"
}
},
"size-limit": [
{
"path": "dist/emoji-mart.js",
"limit": "110 KB"
}
]
}

View File

@ -1,11 +1,12 @@
var path = require('path')
var pack = require('../package.json')
var webpack = require('webpack')
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var PROD = process.env.NODE_ENV === 'production';
var TEST = process.env.NODE_ENV === 'test';
module.exports = {
var config = {
entry: path.resolve('src/index.js'),
output: {
path: path.resolve('dist'),
@ -14,14 +15,7 @@ module.exports = {
libraryTarget: 'umd',
},
externals: !TEST && [{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
}],
externals: [],
module: {
loaders: [
@ -56,3 +50,22 @@ module.exports = {
bail: true,
}
if (!TEST) {
config.externals = config.externals.concat([
{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
])
config.plugins = config.plugins.concat([
new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false }),
])
}
module.exports = config

2110
yarn.lock

File diff suppressed because it is too large Load Diff