2018-05-28 06:49:15 -05:00
|
|
|
'use strict';
|
|
|
|
|
2021-08-31 05:55:05 -05:00
|
|
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2022-04-22 08:33:13 -05:00
|
|
|
const path = require('path');
|
|
|
|
const { DefinePlugin } = require('webpack');
|
|
|
|
const { merge } = require('webpack-merge');
|
|
|
|
|
|
|
|
const common = require('./webpack.common.js');
|
2018-05-28 06:49:15 -05:00
|
|
|
|
|
|
|
module.exports = merge(common, {
|
2021-08-31 05:55:05 -05:00
|
|
|
devtool: 'inline-source-map',
|
2019-07-19 23:46:41 -05:00
|
|
|
mode: 'development',
|
2018-05-28 06:49:15 -05:00
|
|
|
|
2021-08-31 05:55:05 -05:00
|
|
|
entry: {
|
|
|
|
app: ['./public/app/index.ts'],
|
|
|
|
dark: './public/sass/grafana.dark.scss',
|
|
|
|
light: './public/sass/grafana.light.scss',
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
2021-08-31 05:55:05 -05:00
|
|
|
watchOptions: {
|
|
|
|
ignored: /node_modules/,
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
devServer: {
|
2021-08-31 05:55:05 -05:00
|
|
|
devMiddleware: {
|
|
|
|
writeToDisk: true,
|
|
|
|
},
|
|
|
|
historyApiFallback: true,
|
2018-05-28 06:49:15 -05:00
|
|
|
hot: true,
|
2021-08-31 05:55:05 -05:00
|
|
|
open: false,
|
2018-05-28 06:49:15 -05:00
|
|
|
port: 3333,
|
|
|
|
proxy: {
|
2018-10-31 07:23:05 -05:00
|
|
|
'!/public/build': 'http://localhost:3000',
|
|
|
|
},
|
2021-08-31 05:55:05 -05:00
|
|
|
static: {
|
|
|
|
publicPath: '/public/build/',
|
2020-01-30 03:54:11 -06:00
|
|
|
},
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2020-01-30 03:54:11 -06:00
|
|
|
// Note: order is bottom-to-top and/or right-to-left
|
|
|
|
rules: [
|
|
|
|
{
|
2018-11-01 08:03:02 -05:00
|
|
|
test: /\.tsx?$/,
|
2021-08-31 05:55:05 -05:00
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
2021-11-18 10:38:58 -06:00
|
|
|
options: {
|
|
|
|
cacheDirectory: true,
|
|
|
|
cacheCompression: false,
|
|
|
|
},
|
2021-08-31 05:55:05 -05:00
|
|
|
},
|
2018-05-28 06:49:15 -05:00
|
|
|
exclude: /node_modules/,
|
2021-08-31 05:55:05 -05:00
|
|
|
include: [path.resolve(__dirname, '../../public/'), path.resolve(__dirname, '../../packages/')],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
2021-08-31 05:55:05 -05:00
|
|
|
require('./sass.rule.js')({
|
|
|
|
sourceMap: false,
|
|
|
|
preserveUrl: false,
|
|
|
|
}),
|
2018-10-31 07:23:05 -05:00
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
2021-08-31 05:55:05 -05:00
|
|
|
// https://webpack.js.org/guides/build-performance/#output-without-path-info
|
|
|
|
output: {
|
|
|
|
filename: '[name].js',
|
|
|
|
pathinfo: false,
|
|
|
|
},
|
|
|
|
|
|
|
|
// https://webpack.js.org/guides/build-performance/#avoid-extra-optimization-steps
|
|
|
|
optimization: {
|
|
|
|
runtimeChunk: true,
|
|
|
|
removeAvailableModules: false,
|
|
|
|
removeEmptyChunks: false,
|
|
|
|
splitChunks: false,
|
|
|
|
},
|
|
|
|
|
2018-05-28 06:49:15 -05:00
|
|
|
plugins: [
|
2021-08-31 05:55:05 -05:00
|
|
|
new MiniCssExtractPlugin({
|
2022-05-26 04:49:18 -05:00
|
|
|
filename: 'grafana.[name].[contenthash].css',
|
2021-08-31 05:55:05 -05:00
|
|
|
}),
|
|
|
|
new ReactRefreshWebpackPlugin(),
|
|
|
|
new DefinePlugin({
|
2018-05-28 06:49:15 -05:00
|
|
|
'process.env': {
|
2018-10-31 07:23:05 -05:00
|
|
|
NODE_ENV: JSON.stringify('development'),
|
|
|
|
},
|
2018-05-28 06:49:15 -05:00
|
|
|
}),
|
2018-10-31 07:23:05 -05:00
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
});
|