webpack.dev.conf.js
2021-07-08 03:04
标签:依赖 hot map git 规则 script mit mil fine var utils = require(‘./utils‘) // 一个可以合并数组和对象的插件 // 一个用于生成HTML文件并自动注入依赖文件(link/script)的webpack插件 // 用于更友好地输出webpack的警告、错误等信息 // add hot-reload related code to entry chunks // 合并基础的webpack配置 module: { // 配置Source Maps。在开发中使用cheap-module-eval-source-map更快 // 配置webpack插件 // 后页面中的报错不会阻塞,但是会在编译结束后报错 webpack.dev.conf.js 标签:依赖 hot map git 规则 script mit mil fine 原文地址:http://www.cnblogs.com/moneyss/p/7098570.html
var webpack = require(‘webpack‘)
var config = require(‘../config‘)
var merge = require(‘webpack-merge‘)
var baseWebpackConfig = require(‘./webpack.base.conf‘)
var HtmlWebpackPlugin = require(‘html-webpack-plugin‘)
var FriendlyErrorsPlugin = require(‘friendly-errors-webpack-plugin‘)
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = [‘./build/dev-client‘].concat(baseWebpackConfig.entry[name])
})
module.exports = merge(baseWebpackConfig, {
// 配置样式文件的处理规则,使用styleLoaders
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
devtool: ‘#cheap-module-eval-source-map‘,
plugins: [
new webpack.DefinePlugin({
‘process.env‘: config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: ‘index.html‘,
template: ‘index.html‘,
inject: true
}),
new FriendlyErrorsPlugin()
]
})
文章标题:webpack.dev.conf.js
文章链接:http://soscw.com/index.php/essay/102257.html