webpack配置
来源:互联网 发布:易语言网页填表源码 编辑:程序博客网 时间:2024/05/19 02:45
webpack.common.js
const path = require('path');const HtmlWebpackPlugin = require('html-webpack-plugin');const CleanWebpackPlugin = require('clean-webpack-plugin');const webpack = require('webpack');module.exports = { entry: { index: "./src/index.js", another: "./src/anther-module.js", vendor: [ 'lodash' ] }, plugins: [ new CleanWebpackPlugin(['dist']), new HtmlWebpackPlugin({ title: "code spliting" }), new webpack.HashedModuleIdsPlugin(), new webpack.optimize.CommonsChunkPlugin({ name: 'vendor' }), new webpack.optimize.CommonsChunkPlugin({ name: 'common' }) ], module: { loaders: [{ test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader' }], }, output: { filename: '[name].[chunkhash].js', chunkFilename: '[name].[chunkhash].js', path: path.resolve(__dirname, 'dist') }};
webpack.prod.js
const merge = require('webpack-merge');const common = require('./webpack.common.js');const UglifyjsWebpackPlugin = require('uglifyjs-webpack-plugin');const webpack = require('webpack');module.exports = merge(common, { plugins: [ new UglifyjsWebpackPlugin({ sourceMap: true }), new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }) ]});
webpack.dev.js
const merge = require('webpack-merge');const common = require('./webpack.common.js');module.exports = merge(common, { devtool: "inline-source-map", devServer: { contentBase: "./dist" }});
阅读全文
0 0
- webpack配置
- webpack配置
- webpack 配置
- webpack配置
- webpack配置
- webpack 配置
- webpack配置
- webpack配置
- Webpack配置
- webpack配置
- webpack echarts配置实例
- webpack安装和配置
- webpack 发布配置
- webpack配置浅析
- webpack(二)配置
- django-webpack配置
- gulp+webpack配置
- React+Webpack打包配置
- LibreOJ 6178「美团 CodeM 初赛 Round B」景区路线规划
- Tablayout与XListView
- 树莓派GPIO入门05-驱动数码管显示数字(嵌入式很好的链接平台,见解深刻)
- ImageLoader的使用
- Largest_Rectangle_in_Histogram
- webpack配置
- 常用的依赖和权限
- 学习验证
- canvas scale()画布缩放的使用
- 博客迁移到简书
- json解析数据流代码
- Qt之实现录音播放及raw(pcm)转wav格式
- 内存池的实现
- Humble Numbers(优先队列)