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
1 changed files with 13 additions and 7 deletions

View File

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