-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack 2/3 new & npm clean #7
Comments
生产环境构建https://webpack.js.org/guides/production-build/ https://doc.webpack-china.org/guides/production-build/ --optimize-minimize
自动方式运行webpack -p (也可以运行 webpack --optimize-minimize --define process.env.NODE_ENV="'production'",他们是等效的)。 webpack --optimize-minimize --define process.env.NODE_ENV="'production'"
它会执行如下步骤: 使用 UglifyJsPlugin 进行 JS 文件压缩 $ webpack -p
$ webpack --optimize-minimize --define process.env.NODE_ENV="production"
https://doc.webpack-china.org/guides/production-build/ http://lisperator.net/uglifyjs/ https://github.com/mishoo/UglifyJS2/ https://github.com/mishoo/UglifyJS2#usage 手动方式当我们确实有为针对多种环境而分别配置的需求时, webpack.dev.js webpack.prod.js package.json "scripts": { webpack.config.js module.exports = function(env) { https://doc.webpack-china.org/api/cli/#common-options https://webpack.js.org/guides/environment-variables/ webpack/webpack#2537 https://survivejs.com/webpack/optimizing/environment-variables/ "scripts": { https://github.com/webpack/webpack-cli https://doc.webpack-china.org/api/cli/#common-options $ webpack --config webpack.config.js
$ webpack
$ webpack --env.production
$ webpack --env.platform=web
$ webpack --json
$ webpack --json > stats.json
https://www.npmjs.com/package/webpack-env $ webpack --env
$ webpack --env.production
$ webpack -d
$ webpack --debug --devtool eval-cheap-module-source-map --output-pathinfo
$ webpack -p
$ webpack --optimize-minimize --define process.env.NODE_ENV="production"
$ webpack --profile
https://webpack.js.org/api/cli/ 高级途径一个更复杂的方法是,有一个基本配置文件, 用于执行此"合并"工作的工具简称为 webpack-merge, https://github.com/survivejs/webpack-merge webpack.common.js |
cmd & webpack
# webpack [--config webpack.config.js]
$ webpack
$ webpack --config webpack.config.js
$ webpack -w
$ webpack --config webpack.config.js --watch
# sourceMaps & webpack-dev-server
$ webpack --config webpack.dev.config.js
# uglify & minify & clean & webpack -p
$ webpack --config webpack.prod.config.js
# node_modules/.bin/webpack
# webpack.cmd
# webpack-dev-server.cmd
# webpack <entry> [<entry>] <output>
$ webpack src/index.js dist/index.js
$ webpack src/app.js dist/app.js -w
# --watch / -w
|
webpack2 new
webpack2 & npm clean
https://www.npmjs.com/package/rimraf
rimraf
https://github.com/isaacs/rimraf
$ rm -rf
https://gist.github.com/xgqfrms-GitHub/f71453cff397181ad927c5217ec9b7e4
webpack2 & npm clean & rimraf
https://github.com/isaacs/rimraf
https://www.npmjs.com/package/gulp-clean
https://www.npmjs.com/package/gulp-clean-css
https://www.npmjs.com/package/clean-webpack-plugin
https://www.npmjs.com/package/friendly-errors-webpack-plugin
https://www.npmjs.com/package/webpack-cleanup-plugin
https://gist.github.com/xgqfrms-GitHub/f71453cff397181ad927c5217ec9b7e4
https://gist.github.com/xgqfrms-GitHub/19829c5d830ea4b2fe0c6ef5a622a1f5
https://github.com/stanzhai/be-a-professional-programmer
https://github.com/kpaxqin/react-from-scratch
https://github.com/zpao/building-react-from-scratch
https://github.com/reactjs/express-react-views
https://github.com/zpao/qrcode.react
https://github.com/facebook/draft-js
https://zpao.github.io/qrcode.react/
https://www.xgqfrms.xyz/
https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build
https://facebook.github.io/react/contributing/implementation-notes.html
https://github.com/kpaxqin/react-from-scratch
https://kpaxqin.github.io/
https://kpaxqin.github.io/blog/2016/03/13/High-order_component_in_React
React进阶——使用高阶组件(Higher-Order Components)优化代码
http://tools.zhaishidan.cn/
The text was updated successfully, but these errors were encountered: