// importing plugins that do not come by default in webpack
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import StyleLintPlugin from 'stylelint-webpack-plugin';
import WarnCaseSensitiveModulesPlugin from 'webpack/lib/WarnCaseSensitiveModulesPlugin';
import Visualizer from 'webpack-visualizer-plugin';
import SimpleProgressPlugin from 'webpack-simple-progress-plugin';
// compile time plugins,
new Webpack.DefinePlugin() :在编译是会自动替换键值对,webpack 自定义的plugin
// build optimization plugins
new webpack.optimize.CommonsChunkPlugin()
new webpack.optimize.UglifyJsPlugin()
new UglifyJsPlugin():压缩JS代码;
new ExtractTextPlugin():分离CSS和JS文件
new webpack.IgnorePlugin()
new HtmlWebpackPlugin(): 这个插件的作用是依据一个简单的模板,帮你生成最终的Html5文件,这个文件中自动引用了你打包后的JS文件
new OccurenceOrderPlugin() :为组件分配ID,通过这个插件webpack可以分析和优先考虑使用最多的模块,并为它们分配最小的ID
// webpack-dev-server enhancement plugins
new DashboardPlugin(),
new webpack.HotModuleReplacementPlugin(),
new HotModuleReplacementPlugin() : 热加载插件
new SimpleProgressPlugin(),
new StyleLintPlugin(),
Issue
After compile, it will show $export is not a function need to exclude node_module in babel-loader or add some parameter in babel-runtime plugin
Webpack link :
Webpack 1 - https://webpack.github.io/docs/ Webpack 2 - https://webpack.js.org/ 中文文档2.2 :http://www.css88.com/doc/webpack2/loaders/bundle-loader/
devtool
webpackConfig.devtool = 'source-map';
Plugins:
// importing plugins that do not come by default in webpack import HtmlWebpackPlugin from 'html-webpack-plugin'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; import StyleLintPlugin from 'stylelint-webpack-plugin'; import WarnCaseSensitiveModulesPlugin from 'webpack/lib/WarnCaseSensitiveModulesPlugin'; import Visualizer from 'webpack-visualizer-plugin'; import SimpleProgressPlugin from 'webpack-simple-progress-plugin';
// build optimization plugins
// webpack-dev-server enhancement plugins
Issue