Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3377192
D6114.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6114.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6114: [lib] Include COMM_ALCHEMY_KEY in web Webpack build as well
Attached
Detach File
Event Timeline
Log In to Comment