Performance improvement: stop serving wrapper code (#179)

* Only serve react app in development

- Don't serve server code from "webpack serve"
- Don't serve iframe wrapper from "webpack serve"
- Update "basic" local test to load -impl file, not wrapper
This commit is contained in:
Elisha Nuchi
2023-03-10 14:43:48 -05:00
committed by GitHub
parent 50fc0de433
commit 7fd979aed8
10 changed files with 22 additions and 8 deletions
+8 -5
View File
@@ -25,6 +25,8 @@ envVars.NODE_ENV = process.env.NODE_ENV;
envVars.PORT = PORT;
const isProd = process.env.NODE_ENV === 'production';
const isWebpackServe = process.env.WEBPACK_SERVE === 'true';
const publicPath = process.env.ASSET_PATH || '/';
/*********************************
@@ -387,10 +389,11 @@ module.exports = [
// 2. Set up webpack dev server during development
// Note: devServer settings are only read in the first element when module.exports is an array
{ ...copyFilesConfig, ...(isProd ? {} : { devServer }) },
// 3. Create the server bundle
serverConfig,
// 3. Create the server bundle. Don't serve server bundle when running webpack serve.
!isWebpackServe && serverConfig,
// 4. Create one client bundle for each client entrypoint.
...clientConfigs,
// 5. Create a development dialog bundle for each client entrypoint during development.
...(isProd ? [] : devClientConfigs),
];
// 5. Create a development dialog wrapper bundle for each client entrypoint during development.
// Don't actually serve it though when running webpack serve.
...(isProd || isWebpackServe ? [] : devClientConfigs),
].filter(Boolean);