Skip to content

Commit

Permalink
Adjust build script (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
homerchen19 committed Jan 21, 2018
1 parent c31db79 commit aaf6c07
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
},
"version": "0.2.1",
"scripts": {
"build": "node utils/build.js",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.js --display-error-details --progress --colors --optimize-minimize",
"precommit": "lint-staged",
"lint": "eslint src",
"lint:fix": "npm run lint -- --fix",
Expand All @@ -36,6 +36,7 @@
"babel-preset-env": "^1.6.1",
"clean-webpack-plugin": "^0.1.17",
"copy-webpack-plugin": "^4.3.1",
"cross-env": "^5.1.3",
"css-loader": "^0.25.0",
"eslint": "^4.14.0",
"eslint-config-airbnb": "^16.1.0",
Expand Down
6 changes: 0 additions & 6 deletions utils/build.js

This file was deleted.

14 changes: 14 additions & 0 deletions webpack.config.js
Expand Up @@ -95,6 +95,20 @@ const options = {

if (env.NODE_ENV === 'development') {
options.devtool = 'cheap-module-eval-source-map';
} else if (env.NODE_ENV === 'production') {
options.plugins.push(
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: false,
},
sourceMap: true,
})
);
}

module.exports = options;
11 changes: 11 additions & 0 deletions yarn.lock
Expand Up @@ -1565,6 +1565,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

cross-env@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.3.tgz#f8ae18faac87692b0a8b4d2f7000d4ec3a85dfd7"
dependencies:
cross-spawn "^5.1.0"
is-windows "^1.0.0"

cross-spawn@^5.0.1, cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand Down Expand Up @@ -3455,6 +3462,10 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"

is-windows@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.1.tgz#310db70f742d259a16a369202b51af84233310d9"

is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
Expand Down

0 comments on commit aaf6c07

Please sign in to comment.