{"size": 2763, "ext": "js", "max_stars_repo_path": "webpack/config.js", "max_stars_repo_name": "JustArchiNET/ASF-ui", "max_stars_repo_stars_event_min_datetime": "2018-09-22T20:15:02.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T12:49:24.000Z", "max_issues_repo_path": "webpack/config.js", "max_issues_repo_name": "JustArchiNET/ASF-ui", "max_issues_repo_issues_event_min_datetime": "2018-09-23T00:02:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-15T01:44:45.000Z", "max_forks_repo_path": "webpack/config.js", "max_forks_repo_name": "JustArchiNET/ASF-ui", "max_forks_repo_forks_event_min_datetime": "2018-09-22T20:42:54.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T02:45:27.000Z"}
{"max_stars_count": 182, "max_issues_count": 678, "max_forks_count": 70, "avg_line_length": 23.4152542373, "max_line_length": 95, "alphanum_fraction": 0.4788273616}
const path = require('path');

const { DefinePlugin } = require('webpack');
const { VueLoaderPlugin } = require('vue-loader');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const WebpackBeforeBuildPlugin = require('before-build-webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const generateFlags = require('../scripts/generateFlags');
const getCommitHash = require('../scripts/getCommitHash');

module.exports = {
  mode: 'development',
  devtool: 'inline-source-map',
  entry: {
    main: './src/index.js',
  },
  output: {
    filename: 'scripts/[name].[contenthash:7].bundle.js',
    chunkFilename: 'scripts/[id].[contenthash:7].chunk.js',
    path: path.resolve(__dirname, '../dist'),
    publicPath: '/',
    crossOriginLoading: 'anonymous',
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
      },
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: [
              ['@babel/preset-env', {
                targets: { browsers: ['> 1%', 'not ie <= 11'] },
                modules: false,
              }],
            ],
            plugins: ['@babel/plugin-syntax-dynamic-import'],
          },
        },
      },
      {
        test: /\.scss$/,
        use: [
          'vue-style-loader',
          {
            loader: 'css-loader',
            options: {
              esModule: false,
            },
          },
          'sass-loader',
        ],
      },
      {
        test: /\.css$/,
        use: [
          'vue-style-loader',
          {
            loader: 'css-loader',
            options: {
              esModule: false,
            },
          },
        ],
      },
      {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf|png|jpe?g|gif|svg)(\?.*)?$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 8192,
            name: 'media/[name].[contenthash:7][ext]',
          },
        },
      },
    ],
  },
  plugins: [
    new WebpackBeforeBuildPlugin((stats, callback) => {
      generateFlags();
      callback();
    }),
    new CleanWebpackPlugin(),
    new VueLoaderPlugin(),
    new DefinePlugin(({
      APP_HASH: JSON.stringify(getCommitHash()),
    })),
    new HtmlWebpackPlugin({
      template: './src/index.html',
    }),
  ],
  devServer: {
    historyApiFallback: true,
    open: true,
    proxy: {
      '/api': {
        target: 'http://localhost:1242',
        ws: true,
      },
      '/swagger': {
        target: 'http://localhost:1242',
      },
    },
    static: {
      directory: './src/static',
    },
  },
  watchOptions: {
    ignored: /generated/,
  },
};
