2017-03-13 20:52:53 +01:00
|
|
|
var utils = require('./utils')
|
2017-01-14 12:35:55 +01:00
|
|
|
var webpack = require('webpack')
|
2017-03-13 20:52:53 +01:00
|
|
|
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')
|
2017-03-13 20:52:53 +01:00
|
|
|
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: {
|
2017-03-13 20:52:53 +01:00
|
|
|
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
|
2017-01-14 12:35:55 +01:00
|
|
|
},
|
2017-03-13 20:52:53 +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: [
|
2017-01-26 22:11:06 +01:00
|
|
|
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(),
|
2017-03-13 20:52:53 +01:00
|
|
|
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
|
2017-03-13 20:52:53 +01:00
|
|
|
}),
|
|
|
|
new FriendlyErrorsPlugin()
|
2017-01-14 12:35:55 +01:00
|
|
|
]
|
|
|
|
})
|