Skip to content

Commit

Permalink
CHANGE measure build-size with webpack instead of browserify
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Jul 10, 2018
1 parent 294748f commit 41cb52e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
28 changes: 28 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;


//console.log(process.env.NODE_ENV);
//process.exit();


const plugins = [];
if (process.env.NODE_ENV === 'disc')
plugins.push(new BundleAnalyzerPlugin());

module.exports = {
mode: 'production',
entry: './dist/es/index.js',
optimization: {
minimizer: [
new UglifyJsPlugin()
]
},
plugins,
output: {
path: path.resolve(__dirname, '../test_tmp'),
filename: 'webpack.bundle.js'
}
};
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@
"build:es": "rimraf -rf dist/es && cross-env NODE_ENV=es6 babel src --out-dir dist/es",
"build": "npm run clear && npm run transpile && npm run build:es && browserify dist/lib/browserify.index.js > dist/rxdb.browserify.js && uglifyjs --compress --mangle --output dist/rxdb.browserify.min.js -- dist/rxdb.browserify.js",
"build:min": "npm run transpile && browserify dist/lib/browserify.index.js > dist/rxdb.browserify.js && uglifyjs --compress --mangle --output dist/rxdb.browserify.min.js -- dist/rxdb.browserify.js",
"build:size": "echo \"Build-Size (minified+gzip):\" && gzip-size --raw ./dist/rxdb.browserify.min.js",
"build:webpack": "npm run transpile && cross-env NODE_ENV=build webpack --config ./config/webpack.config.js",
"build:size": "npm run build:webpack && echo \"Build-Size (minified+gzip):\" && gzip-size --raw ./test_tmp/webpack.bundle.js",
"docs:install": "gitbook install docs-src",
"docs:serve": "gitbook serve docs-src",
"docs:build": "gitbook install docs-src && gitbook build docs-src docs && cp docs-src/files/logo/icon.png docs/gitbook/images/apple-touch-icon-precomposed-152.png && cp docs-src/files/logo/icon.ico docs/gitbook/images/favicon.ico && npm run docs:copy",
"docs:copy": "cp -r docs-src/files docs/files",
"disc": "npm run transpile && browserify dist/lib/index.js --full-paths | uglifyjs --compress --mangle | discify --open --full-paths",
"disc": "npm run transpile && cross-env NODE_ENV=disc webpack --config ./config/webpack.config.js",
"preversion": "npm run lint && npm run test",
"dev": "watch 'npm run test:fast' src/ test/",
"dev:example": "watch 'npm run transpile:src && echo \"done\"' src/ test/"
Expand Down Expand Up @@ -171,7 +172,9 @@
"walk-sync": "0.3.2",
"watch": "1.0.2",
"watchify": "3.11.0",
"webpack": "4.9.1"
"webpack": "4.9.1",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.0.8"
},
"// greenkeeper": [
"// babel-eslint: https://github.com/babel/babel-eslint/issues/530",
Expand Down

0 comments on commit 41cb52e

Please sign in to comment.