2019-04-09 00:21:00 +02:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const webpack = require('webpack')
|
2020-11-25 21:39:40 +01:00
|
|
|
const { merge } = require('webpack-merge')
|
2019-04-09 00:21:00 +02:00
|
|
|
const baseConfig = require('./webpack.config.base')
|
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
2021-08-04 13:49:26 +02:00
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
2022-08-10 14:49:59 +02:00
|
|
|
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
|
2019-04-09 00:21:00 +02:00
|
|
|
|
|
|
|
module.exports = merge(baseConfig, {
|
|
|
|
mode: 'development',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
2021-03-19 16:06:06 +01:00
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: '',
|
|
|
|
},
|
|
|
|
},
|
2019-04-09 00:21:00 +02:00
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
2021-03-19 16:06:06 +01:00
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: '',
|
|
|
|
},
|
|
|
|
},
|
2019-04-09 00:21:00 +02:00
|
|
|
'css-loader',
|
|
|
|
'sass-loader'
|
|
|
|
]
|
2019-06-17 14:07:27 +02:00
|
|
|
}, {
|
2021-03-29 22:28:24 +02:00
|
|
|
test: /\.(png|jpg|gif|svg)$/,
|
2019-06-17 14:07:27 +02:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 5000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2019-04-09 00:21:00 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
// new webpack.HotModuleReplacementPlugin()
|
2021-08-04 13:49:26 +02:00
|
|
|
new BundleAnalyzerPlugin({
|
|
|
|
'analyzerMode': 'static'
|
2022-08-10 14:49:59 +02:00
|
|
|
}),
|
|
|
|
new WebpackShellPluginNext({
|
|
|
|
// onBuildStart:{
|
|
|
|
// scripts: ['echo "Webpack Start"'],
|
|
|
|
// blocking: true,
|
|
|
|
// parallel: false
|
|
|
|
// },
|
|
|
|
// drush is not installed in this container so we have to ssh on the php container
|
|
|
|
onAfterDone:{
|
|
|
|
scripts: ['echo "Clearing drupal cache $USER_UNAME $DRUPAL_ROOT"', 'sshpass -p "$USER_UNAME" ssh $USER_UNAME@php "cd $DRUPAL_ROOT && drush cc css-js"', 'echo "Done"'],
|
|
|
|
blocking: true,
|
|
|
|
parallel: false
|
|
|
|
}
|
2021-08-04 13:49:26 +02:00
|
|
|
})
|
2019-04-09 00:21:00 +02:00
|
|
|
]
|
|
|
|
})
|