Upgrade to Webpack 4 - development config

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2018-09-02 10:57:59 +02:00
parent 6056f9a392
commit c66aa60495
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB

View file

@ -1,10 +1,14 @@
var baseConfig = require('./webpackBaseConfig')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
var path = require('path')
module.exports = [Object.assign({}, baseConfig, {
plugins: baseConfig.plugins.concat([
new ExtractTextPlugin('[name].css')
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
})
]),
devtool: 'source-map'
}), {
@ -13,15 +17,15 @@ module.exports = [Object.assign({}, baseConfig, {
htmlExport: path.join(__dirname, 'public/js/htmlExport.js')
},
module: {
loaders: [{
rules: [{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
use: ['style-loader', 'css-loader']
}, {
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'sass-loader')
use: ['style-loader', 'sass-loader']
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'less-loader')
use: ['style-loader', 'less-loader']
}]
},
output: {
@ -30,6 +34,8 @@ module.exports = [Object.assign({}, baseConfig, {
filename: '[name].js'
},
plugins: [
new ExtractTextPlugin('html.min.css')
new MiniCssExtractPlugin({
filename: 'html.min.css'
})
]
}]