text: /* eslint-disable import/no-extraneous-dependencies */
  const webpack = require('webpack');
  const path = require('path');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const ExtractTextPlugin = require('extract-text-webpack-plugin');
  
  module.exports = {
    target: 'web',
    mode: 'production',
    entry: path.join(__dirname, './src/index.js'),
    output: {
      path: path.join(__dirname, '/target/classes/zipkin-lens/'),
      filename: 'app-[hash].min.js',
      publicPath: '/zipkin/',
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: [/node_modules/],
          use: {
            loader: 'babel-loader',
          },
        },
        {
          test: /\.scss$/,
          use: ExtractTextPlugin.extract({
            fallback: 'style-loader',
            use: [
              {
                loader: 'css-loader',
                options: {
                  url: false,
                  sourceMap: true,
                },
              },
              {
                loader: 'sass-loader',
                options: {
                  sourceMap: true,
                },
              },
            ],
          }),
        },
        {
          test: /\.html$/,
          loader: 'html-loader',
          options: {
            minimize: true,
          },
        },
        {
          test: /\.(jpg|png)$/,
          loader: 'url-loader',
        },
        {
          test: /\.svg$/,
          use: [
            {
              loader: 'babel-loader',
            },
            {
              loader: 'react-svg-loader',
              options: {
                jsx: true,
              },
            },
          ],
        },
      ],
    },
    resolve: {
      extensions: ['.js'],
    },
    plugins: [
      new ExtractTextPlugin('style-[hash].min.css', { allChunks: true }),
      new HtmlWebpackPlugin({
        template: path.join(__dirname, './static/index.html'),
      }),
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify(process.env.NODE_ENV),
          API_BASE: JSON.stringify(process.env.API_BASE),
        },
      }),
    ],
    optimization: {
      minimize: true,
    },
  };
  