fe-drone-ci/build/webpack.dev.conf.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-04-18 07:09:13 +00:00
var utils = require('./utils')
var path = require('path')
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')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
2017-08-07 08:11:10 +00:00
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
2017-04-18 07:09:13 +00:00
})
function resolveApp(relativePath) {
2017-08-07 08:11:10 +00:00
return path.resolve(relativePath);
2017-04-18 07:09:13 +00:00
}
module.exports = merge(baseWebpackConfig, {
2017-08-07 08:11:10 +00:00
module: {
2017-11-09 10:27:00 +00:00
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
2017-08-07 08:11:10 +00:00
},
// cheap-source-map is faster for development
devtool: '#cheap-source-map',
cache: true,
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
2017-08-07 08:11:10 +00:00
}),
// 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',
favicon: resolveApp('favicon.ico'),
inject: true,
path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
}),
new FriendlyErrorsPlugin()
]
2017-04-18 07:09:13 +00:00
})
2017-08-07 08:11:10 +00:00