webpack.config.dev.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. 'use strict'
  2. const webpack = require('webpack')
  3. const { merge } = require('webpack-merge')
  4. const baseConfig = require('./webpack.config.base')
  5. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  6. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  7. const WebpackShellPluginNext = require('webpack-shell-plugin-next');
  8. module.exports = merge(baseConfig, {
  9. mode: 'development',
  10. module: {
  11. rules: [
  12. {
  13. test: /\.css$/,
  14. use: [
  15. {
  16. loader: MiniCssExtractPlugin.loader,
  17. options: {
  18. publicPath: '',
  19. },
  20. },
  21. 'css-loader'
  22. ]
  23. }, {
  24. test: /\.scss$/,
  25. use: [
  26. {
  27. loader: MiniCssExtractPlugin.loader,
  28. options: {
  29. publicPath: '',
  30. },
  31. },
  32. 'css-loader',
  33. 'sass-loader'
  34. ]
  35. }, {
  36. test: /\.(png|jpg|gif|svg)$/,
  37. use: [
  38. {
  39. loader: 'url-loader',
  40. options: {
  41. limit: 5000
  42. }
  43. }
  44. ]
  45. }
  46. ]
  47. },
  48. plugins: [
  49. // new webpack.HotModuleReplacementPlugin()
  50. new BundleAnalyzerPlugin({
  51. 'analyzerMode': 'static'
  52. }),
  53. new WebpackShellPluginNext({
  54. // onBuildStart:{
  55. // scripts: ['echo "Webpack Start"'],
  56. // blocking: true,
  57. // parallel: false
  58. // },
  59. // drush is not installed in this container so we have to ssh on the php container
  60. onAfterDone:{
  61. 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"'],
  62. blocking: true,
  63. parallel: false
  64. }
  65. })
  66. ]
  67. })