github.com/grafana/pyroscope@v1.18.0/scripts/webpack/webpack.dev.js (about)

     1  const { merge } = require('webpack-merge');
     2  const HtmlWebpackPlugin = require('html-webpack-plugin');
     3  const common = require('./webpack.common');
     4  const webpack = require('webpack');
     5  const path = require('path');
     6  
     7  module.exports = merge(common, {
     8    devtool: 'eval-source-map',
     9    mode: 'development',
    10    devServer: {
    11      port: 4041,
    12      historyApiFallback: true,
    13      proxy: [
    14        {
    15          context: ['/pyroscope'],
    16          target: 'http://localhost:4040',
    17          changeOrigin: true,
    18        },
    19        {
    20          context: ['/querier.v1.QuerierService'],
    21          target: 'http://localhost:4040',
    22          changeOrigin: true,
    23        },
    24        {
    25          context: ['/assets/grafana'],
    26          target: 'http://localhost:4041',
    27          pathRewrite: { '^/assets': '' },
    28          logLevel: 'debug',
    29        },
    30      ],
    31    },
    32    optimization: {
    33      runtimeChunk: 'single',
    34    },
    35    plugins: [
    36      new webpack.DefinePlugin({
    37        'process.env.BASEPATH': JSON.stringify('/'),
    38      }),
    39      // Duplicated in webpack.prod.js
    40      new HtmlWebpackPlugin({
    41        filename: path.resolve(__dirname, '../../public/build/index.html'),
    42        favicon: path.resolve(__dirname, '../../public/app/images/favicon.ico'),
    43        template: path.resolve(__dirname, '../../public/templates/index.html'),
    44        chunksSortMode: 'none',
    45      }),
    46    ],
    47  });