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
@@ -3,6 +3,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<base target="_top" />
|
<base target="_top" />
|
||||||
<!-- Add any external scripts and stylesheets here -->
|
<!-- Add any external scripts and stylesheets here -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
|
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
/* needed to make consistent test snapshots across OSs */
|
/* needed to make consistent test snapshots across OSs */
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
font-family: Arial !important;
|
font-family: Roboto !important;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@@ -29,7 +29,7 @@ const webpackDevServerReady = async (process) => {
|
|||||||
console.log('Waiting for Webpack Dev Server to finish loading...');
|
console.log('Waiting for Webpack Dev Server to finish loading...');
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
process.stdout.on('data', (data) => {
|
process.stdout.on('data', (data) => {
|
||||||
if (data.includes('DEVELOPMENT: CLIENT - Dialog Demo Bootstrap')) {
|
if (data.includes('CLIENT - Dialog Demo Bootstrap')) {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -56,12 +56,13 @@ describe(`Local setup ${isExtended ? '*extended*' : ''}`, () => {
|
|||||||
if (isExtended) {
|
if (isExtended) {
|
||||||
await openAddon(page);
|
await openAddon(page);
|
||||||
} else {
|
} else {
|
||||||
await page.goto('https://localhost:3000/dialog-demo-bootstrap.html');
|
await page.goto('https://localhost:3000/dialog-demo-bootstrap-impl.html');
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForTimeout(3000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
console.log('Closing process.');
|
||||||
process.kill();
|
process.kill();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ envVars.NODE_ENV = process.env.NODE_ENV;
|
|||||||
envVars.PORT = PORT;
|
envVars.PORT = PORT;
|
||||||
|
|
||||||
const isProd = process.env.NODE_ENV === 'production';
|
const isProd = process.env.NODE_ENV === 'production';
|
||||||
|
const isWebpackServe = process.env.WEBPACK_SERVE === 'true';
|
||||||
|
|
||||||
const publicPath = process.env.ASSET_PATH || '/';
|
const publicPath = process.env.ASSET_PATH || '/';
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
@@ -387,10 +389,11 @@ module.exports = [
|
|||||||
// 2. Set up webpack dev server during development
|
// 2. Set up webpack dev server during development
|
||||||
// Note: devServer settings are only read in the first element when module.exports is an array
|
// Note: devServer settings are only read in the first element when module.exports is an array
|
||||||
{ ...copyFilesConfig, ...(isProd ? {} : { devServer }) },
|
{ ...copyFilesConfig, ...(isProd ? {} : { devServer }) },
|
||||||
// 3. Create the server bundle
|
// 3. Create the server bundle. Don't serve server bundle when running webpack serve.
|
||||||
serverConfig,
|
!isWebpackServe && serverConfig,
|
||||||
// 4. Create one client bundle for each client entrypoint.
|
// 4. Create one client bundle for each client entrypoint.
|
||||||
...clientConfigs,
|
...clientConfigs,
|
||||||
// 5. Create a development dialog bundle for each client entrypoint during development.
|
// 5. Create a development dialog wrapper bundle for each client entrypoint during development.
|
||||||
...(isProd ? [] : devClientConfigs),
|
// Don't actually serve it though when running webpack serve.
|
||||||
];
|
...(isProd || isWebpackServe ? [] : devClientConfigs),
|
||||||
|
].filter(Boolean);
|
||||||
|
|||||||