ibt2/build/webpack.dev.conf.js

42 lines
1.3 KiB
JavaScript
Raw Normal View History

var utils = require('./utils')
2017-01-14 12:35:55 +01:00
var webpack = require('webpack')
var config = require('../config')
2017-01-14 12:35:55 +01:00
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
2017-01-14 12:35:55 +01:00
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
})
module.exports = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
2017-01-14 12:35:55 +01:00
},
// cheap-module-eval-source-map is faster for development
devtool: '#cheap-module-eval-source-map',
2017-01-14 12:35:55 +01:00
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery',
jQuery: 'jquery'
}),
2017-01-14 12:35:55 +01:00
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
2017-01-14 12:35:55 +01:00
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
new FriendlyErrorsPlugin()
2017-01-14 12:35:55 +01:00
]
})