chore(frontend): load dotenv for webpack prod and related changes (#3537)

* chore(frontend): 🔧 update dotenv and add example.env

* chore(frontend): 🙈 update .gitignore and .dockerignore

---------

Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
Prashant Shahi 2023-09-13 12:26:16 +05:30 committed by GitHub
parent 54a2309d8f
commit 27cda7a437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 2 deletions

2
.gitignore vendored
View File

@ -37,7 +37,7 @@ frontend/src/constants/env.ts
**/locust-scripts/__pycache__/
**/__debug_bin
frontend/*.env
frontend/.env
pkg/query-service/signoz.db
pkg/query-service/tests/test-deploy/data/

View File

@ -1,5 +1,4 @@
node_modules
.vscode
build
.env
.git

7
frontend/example.env Normal file
View File

@ -0,0 +1,7 @@
NODE_ENV="development"
BUNDLE_ANALYSER="true"
FRONTEND_API_ENDPOINT="http://localhost:3301/"
INTERCOM_APP_ID="intercom-app-id"
PLAYWRIGHT_TEST_BASE_URL="http://localhost:3301"
CI="1"

View File

@ -26,6 +26,7 @@ const plugins = [
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify({
NODE_ENV: process.env.NODE_ENV,
FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT,
INTERCOM_APP_ID: process.env.INTERCOM_APP_ID,
}),

View File

@ -5,6 +5,7 @@ const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const dotenv = require('dotenv');
const webpack = require('webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
@ -13,6 +14,8 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const Critters = require('critters-webpack-plugin');
dotenv.config();
const cssLoader = 'css-loader';
const sassLoader = 'sass-loader';
const styleLoader = 'style-loader';
@ -31,6 +34,7 @@ const plugins = [
new webpack.DefinePlugin({
'process.env': JSON.stringify({
FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT,
INTERCOM_APP_ID: process.env.INTERCOM_APP_ID,
}),
}),
new MiniCssExtractPlugin(),