Page MenuHomePhabricator

D6114.diff
No OneTemporary

D6114.diff

diff --git a/landing/webpack.config.cjs b/landing/webpack.config.cjs
--- a/landing/webpack.config.cjs
+++ b/landing/webpack.config.cjs
@@ -1,6 +1,5 @@
const AssetsPlugin = require('assets-webpack-plugin');
const path = require('path');
-const webpack = require('webpack');
const {
createProdBrowserConfig,
@@ -66,39 +65,18 @@
},
};
-const alchemyKey = process.env.COMM_ALCHEMY_KEY;
-
module.exports = function (env) {
- const rawBrowserConfig =
+ const browserConfig =
env === 'prod'
? createProdBrowserConfig(baseProdBrowserConfig, babelConfig)
: createDevBrowserConfig(baseDevBrowserConfig, babelConfig);
- const browserConfig = {
- ...rawBrowserConfig,
- plugins: [
- ...rawBrowserConfig.plugins,
- new webpack.DefinePlugin({
- 'process.env': {
- COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey),
- },
- }),
- ],
- };
- const baseNodeConfig = createNodeServerRenderingConfig(
+ const nodeConfig = createNodeServerRenderingConfig(
baseNodeServerRenderingConfig,
babelConfig,
);
- const nodeConfig = {
- ...baseNodeConfig,
+ const nodeServerRenderingConfig = {
+ ...nodeConfig,
mode: env === 'prod' ? 'production' : 'development',
- plugins: [
- ...baseNodeConfig.plugins,
- new webpack.DefinePlugin({
- 'process.env': {
- COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey),
- },
- }),
- ],
};
- return [browserConfig, nodeConfig];
+ return [browserConfig, nodeServerRenderingConfig];
};
diff --git a/lib/webpack/shared.cjs b/lib/webpack/shared.cjs
--- a/lib/webpack/shared.cjs
+++ b/lib/webpack/shared.cjs
@@ -89,6 +89,8 @@
};
}
+const alchemyKey = process.env.COMM_ALCHEMY_KEY;
+
function createProdBrowserConfig(baseConfig, babelConfig) {
const browserConfig = createBaseBrowserConfig(baseConfig);
const babelRule = getBrowserBabelRule(babelConfig);
@@ -101,6 +103,7 @@
'process.env': {
NODE_ENV: JSON.stringify('production'),
BROWSER: true,
+ COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey),
},
}),
new MiniCssExtractPlugin({
@@ -166,6 +169,7 @@
'process.env': {
NODE_ENV: JSON.stringify('development'),
BROWSER: true,
+ COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey),
},
}),
new ReactRefreshWebpackPlugin(),
@@ -231,7 +235,14 @@
},
],
},
- plugins: sharedPlugins,
+ plugins: [
+ ...sharedPlugins,
+ new webpack.DefinePlugin({
+ 'process.env': {
+ COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey),
+ },
+ }),
+ ],
};
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 4:20 AM (13 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592743
Default Alt Text
D6114.diff (2 KB)

Event Timeline