Upgrade to Webpack 4 - fix CSS import order

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2018-08-27 13:37:42 +02:00
parent a6d3ac647b
commit dcb10b0ec9
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
2 changed files with 36 additions and 19 deletions

View file

@ -178,7 +178,7 @@
"less": "^2.7.1", "less": "^2.7.1",
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"mini-css-extract-plugin": "^0.4.1", "mini-css-extract-plugin": "^0.4.1",
"optimize-css-assets-webpack-plugin": "^4.0.3", "optimize-css-assets-webpack-plugin": "^5.0.0",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"standard": "^9.0.1", "standard": "^9.0.1",
"string-loader": "^0.0.1", "string-loader": "^0.0.1",
@ -186,7 +186,7 @@
"uglifyjs-webpack-plugin": "^1.2.7", "uglifyjs-webpack-plugin": "^1.2.7",
"url-loader": "^1.0.1", "url-loader": "^1.0.1",
"webpack": "^4.14.0", "webpack": "^4.14.0",
"webpack-cli": "^3.0.8", "webpack-cli": "^3.1.0",
"webpack-parallel-uglify-plugin": "^1.1.0" "webpack-parallel-uglify-plugin": "^1.1.0"
}, },
"standard": { "standard": {

View file

@ -25,13 +25,15 @@ module.exports = {
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font', 'index-styles', 'index'], chunks: ['font', 'index-styles', 'index'],
filename: path.join(__dirname, 'public/views/build/index-header.ejs'), filename: path.join(__dirname, 'public/views/build/index-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font-pack', 'index-styles-pack', 'index-styles', 'index'], chunks: ['font-pack', 'index-styles-pack', 'index-styles', 'index'],
filename: path.join(__dirname, 'public/views/build/index-pack-header.ejs'), filename: path.join(__dirname, 'public/views/build/index-pack-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
@ -43,19 +45,22 @@ module.exports = {
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['common', 'index-pack'], chunks: ['common', 'index-pack'],
filename: path.join(__dirname, 'public/views/build/index-pack-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/index-pack-scripts.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font', 'cover'], chunks: ['font', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-header.ejs'), filename: path.join(__dirname, 'public/views/build/cover-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font-pack', 'cover-styles-pack', 'cover'], chunks: ['font-pack', 'cover-styles-pack', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-pack-header.ejs'), filename: path.join(__dirname, 'public/views/build/cover-pack-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
@ -67,19 +72,22 @@ module.exports = {
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['common', 'cover-pack'], chunks: ['common', 'cover-pack'],
filename: path.join(__dirname, 'public/views/build/cover-pack-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/cover-pack-scripts.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font', 'pretty-styles', 'pretty'], chunks: ['font', 'pretty-styles', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'), filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font-pack', 'pretty-styles-pack', 'pretty-styles', 'pretty'], chunks: ['font-pack', 'pretty-styles-pack', 'pretty-styles', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-pack-header.ejs'), filename: path.join(__dirname, 'public/views/build/pretty-pack-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
@ -91,19 +99,22 @@ module.exports = {
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['common', 'pretty-pack'], chunks: ['common', 'pretty-pack'],
filename: path.join(__dirname, 'public/views/build/pretty-pack-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/pretty-pack-scripts.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font', 'slide-styles', 'slide'], chunks: ['font', 'slide-styles', 'slide'],
filename: path.join(__dirname, 'public/views/build/slide-header.ejs'), filename: path.join(__dirname, 'public/views/build/slide-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['font-pack', 'slide-styles-pack', 'slide-styles', 'slide'], chunks: ['font-pack', 'slide-styles-pack', 'slide-styles', 'slide'],
filename: path.join(__dirname, 'public/views/build/slide-pack-header.ejs'), filename: path.join(__dirname, 'public/views/build/slide-pack-header.ejs'),
inject: false inject: false,
chunksSortMode: 'manual'
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
@ -420,7 +431,8 @@ module.exports = {
test: require.resolve('js-sequence-diagrams'), test: require.resolve('js-sequence-diagrams'),
use: [{ use: [{
loader: 'imports-loader', loader: 'imports-loader',
options: {_: 'lodash', Raphael: 'raphael', eve: 'eve'}}] options: {_: 'lodash', Raphael: 'raphael', eve: 'eve'}
}]
}, { }, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
use: [{loader: 'file-loader'}] use: [{loader: 'file-loader'}]
@ -431,27 +443,32 @@ module.exports = {
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
use: [{ use: [{
loader: 'url-loader', loader: 'url-loader',
options: {prefix: 'font/', limit: '5000'}}] options: {prefix: 'font/', limit: '5000'}
}]
}, { }, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: [{ use: [{
loader: 'url-loader', loader: 'url-loader',
options: {limit: '5000', mimetype: 'application/octet-stream'}}] options: {limit: '5000', mimetype: 'application/octet-stream'}
}]
}, { }, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [{ use: [{
loader: 'url-loader', loader: 'url-loader',
options: {limit: '10000', mimetype: 'svg+xml'}}] options: {limit: '10000', mimetype: 'svg+xml'}
}]
}, { }, {
test: /\.png(\?v=\d+\.\d+\.\d+)?$/, test: /\.png(\?v=\d+\.\d+\.\d+)?$/,
use: [{ use: [{
loader: 'url-loader', loader: 'url-loader',
options: {limit: '10000', mimetype: 'image/png'}}] options: {limit: '10000', mimetype: 'image/png'}
}]
}, { }, {
test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,
use: [{ use: [{
loader: 'url-loader', loader: 'url-loader',
options: {limit: '10000', mimetype: 'image/gif'}}] options: {limit: '10000', mimetype: 'image/gif'}
}]
}] }]
}, },
node: { node: {