mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-12 11:01:27 +08:00

* react-app-env.d.ts is moved to the typings * webpack config for development and production is updated * extra browser router component is removed * loable component is made * spinner component is updated * route are updated * routes are imported is Loadable fashion with chunkName * AppRoute is updated * AppWrapper is changed to AppRouter * merge conflits are resolved * Loadable component is updated Co-authored-by: Ankit Nayan <ankit@signoz.io>
68 lines
1.6 KiB
JavaScript
68 lines
1.6 KiB
JavaScript
// shared config (dev and prod)
|
|
const { resolve } = require("path");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
const CompressionPlugin = require("compression-webpack-plugin");
|
|
const webpack = require("webpack");
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
|
|
module.exports = {
|
|
mode: "production",
|
|
devtool: "source-map",
|
|
entry: resolve(__dirname, "./src/index.tsx"),
|
|
output: {
|
|
filename: ({ chunk: { name, hash } }) => {
|
|
return `js/${name}-${hash}.js`;
|
|
},
|
|
path: resolve(__dirname, "./build"),
|
|
publicPath: "/",
|
|
},
|
|
|
|
resolve: {
|
|
extensions: [".ts", ".tsx", ".js", ".jsx"],
|
|
plugins: [new TsconfigPathsPlugin({})],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: [/\.jsx?$/, /\.tsx?$/],
|
|
use: ["babel-loader"],
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ["style-loader", "css-loader"],
|
|
},
|
|
{
|
|
test: /\.(scss|sass)$/,
|
|
use: ["style-loader", "css-loader", "sass-loader"],
|
|
},
|
|
{
|
|
test: /\.(jpe?g|png|gif|svg)$/i,
|
|
use: [
|
|
"file-loader?hash=sha512&digest=hex&name=img/[chunkhash].[ext]",
|
|
"image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false",
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new CompressionPlugin({
|
|
exclude: /.map$/,
|
|
}),
|
|
new HtmlWebpackPlugin({ template: "src/index.html.ejs" }),
|
|
new CopyPlugin({
|
|
patterns: [{ from: resolve(__dirname, "public/"), to: "." }],
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: "process/browser",
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
"process.env": JSON.stringify(process.env),
|
|
}),
|
|
],
|
|
performance: {
|
|
hints: false,
|
|
},
|
|
};
|