materio-d9/build/webpack.config.dev.js

71 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

'use strict'
const webpack = require('webpack')
const { merge } = require('webpack-merge')
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;
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
module.exports = merge(baseConfig, {
mode: 'development',
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '',
},
},
'css-loader'
]
}, {
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '',
},
},
'css-loader',
'sass-loader'
]
}, {
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 5000
}
}
]
}
]
},
plugins: [
// new webpack.HotModuleReplacementPlugin()
2021-08-04 13:49:26 +02:00
new BundleAnalyzerPlugin({
'analyzerMode': 'static'
}),
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
})
]
})