text: const webpack = require('webpack');
  const writeFilePlugin = require('write-file-webpack-plugin');
  const WorkboxPlugin = require('workbox-webpack-plugin');
  const webpackMerge = require('webpack-merge');
  const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
  const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
  const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
  const WebpackNotifierPlugin = require('webpack-notifier');
  const path = require('path');
  const sass = require('sass');
  
  const utils = require('./utils.js');
  const commonConfig = require('./webpack.common.js');
  
  const ENV = 'development';
  
  module.exports = (options) => webpackMerge(commonConfig({ env: ENV }), {
    devtool: 'cheap-module-source-map', // https://reactjs.org/docs/cross-origin-errors.html
    mode: ENV,
    entry: [
      './src/main/webapp/app/index'
    ],
    output: {
      path: utils.root('target/classes/static/'),
      filename: 'app/[name].bundle.js',
      chunkFilename: 'app/[id].chunk.js'
    },
    module: {
      rules: [
        {
          test: /\.(sa|sc|c)ss$/,
          use: ['style-loader', 'css-loader', 'postcss-loader', {
              loader: 'sass-loader',
              options: { implementation: sass }
            }
          ]
        }
      ]
    },
    devServer: {
      stats: options.stats,
      hot: true,
      contentBase: './target/classes/static/',
      proxy: [{
        context: [
          '/api',
          '/services',
          '/management',
          '/swagger-resources',
          '/v2/api-docs',
          '/h2-console',
          '/auth'
        ],
        target: `http${options.tls ? 's' : ''}://localhost:8080`,
        secure: false,
        changeOrigin: options.tls
      },{
        context: [
          '/websocket'
        ],
        target: 'ws://127.0.0.1:8080',
        ws: true
      }],
      stats: options.stats,
      watchOptions: {
        ignored: /node_modules/
      },
      https: options.tls,
      historyApiFallback: true
    },
    stats: process.env.JHI_DISABLE_WEBPACK_LOGS ? 'none' : options.stats,
    plugins: [
      process.env.JHI_DISABLE_WEBPACK_LOGS
        ? null
        : new SimpleProgressWebpackPlugin({
            format: options.stats === 'minimal' ? 'compact' : 'expanded'
          }),
      new FriendlyErrorsWebpackPlugin(),
      new BrowserSyncPlugin({
        https: options.tls,
        host: 'localhost',
        port: 9000,
        proxy: {
          target: `http${options.tls ? 's' : ''}://localhost:9060`,
          ws: true,
            proxyOptions: {
                changeOrigin: false  //pass the Host header to the backend unchanged  https://github.com/Browsersync/browser-sync/issues/430
            }
        },
        socket: {
          clients: {
            heartbeatTimeout: 60000
          }
        }
      }, {
        reload: false
      }),
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      new writeFilePlugin(),
      new webpack.WatchIgnorePlugin([
        utils.root('src/test'),
      ]),
      new WebpackNotifierPlugin({
        title: 'JHipster',
        contentImage: path.join(__dirname, 'logo-jhipster.png')
      }),
      new WorkboxPlugin.GenerateSW({
        clientsClaim: true,
        skipWaiting: true,
      })
    ].filter(Boolean)
  });
  