chore: Remove env variables in webpack bundle (#1353)

* chore: Remove env variables in webpack bundle

* remove unused globals

* refactor: consolidate window.env calls to single file

* fix: Slack client side integration auth

* fix: developers url
This commit is contained in:
Tom Moor
2020-07-18 11:02:40 -07:00
committed by GitHub
parent 24448c7504
commit 67981a351e
32 changed files with 186 additions and 206 deletions

View File

@@ -1,27 +1,10 @@
/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
require('dotenv').config({ silent: true });
const definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.NODE_ENV !== 'production')),
__PRERELEASE__: JSON.stringify(
JSON.parse(process.env.BUILD_PRERELEASE || 'false')
),
SLACK_APP_ID: JSON.stringify(process.env.SLACK_APP_ID),
BASE_URL: JSON.stringify(process.env.URL),
SENTRY_DSN: JSON.stringify(process.env.SENTRY_DSN),
'process.env': {
DEPLOYMENT: JSON.stringify(process.env.DEPLOYMENT),
URL: JSON.stringify(process.env.URL),
TEAM_LOGO: JSON.stringify(process.env.TEAM_LOGO),
SLACK_KEY: JSON.stringify(process.env.SLACK_KEY),
SUBDOMAINS_ENABLED: JSON.stringify(process.env.SUBDOMAINS_ENABLED === 'true'),
WEBSOCKETS_ENABLED: JSON.stringify(process.env.WEBSOCKETS_ENABLED === 'true')
}
});
module.exports = {
output: {
path: path.join(__dirname, 'dist'),
@@ -65,11 +48,13 @@ module.exports = {
}
},
plugins: [
definePlugin,
new webpack.ProvidePlugin({
fetch: 'imports-loader?this=>global!exports-loader?global.fetch!isomorphic-fetch',
}),
new webpack.IgnorePlugin(/unicode\/category\/So/),
new HtmlWebpackPlugin({
template: 'server/static/index.html',
}),
],
stats: {
assets: false,