From 64ed55e537a49eaa84b1a864077d2fb498d7efe2 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Mon, 27 Nov 2023 11:54:32 -0500 Subject: [PATCH 1/8] set devtool to sourcemap --- packages/pwa-kit-dev/bin/pwa-kit-dev.js | 2 +- packages/pwa-kit-dev/src/configs/webpack/config.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/pwa-kit-dev/bin/pwa-kit-dev.js b/packages/pwa-kit-dev/bin/pwa-kit-dev.js index 2189cf36f1..75e9ec07eb 100755 --- a/packages/pwa-kit-dev/bin/pwa-kit-dev.js +++ b/packages/pwa-kit-dev/bin/pwa-kit-dev.js @@ -238,7 +238,7 @@ const main = async () => { const projectWebpack = p.join(process.cwd(), 'webpack.config.js') const webpackConf = fse.pathExistsSync(projectWebpack) ? projectWebpack - : p.join(__dirname, '..', 'configs', 'webpack', 'config.js') + : p.join(__dirname, '..', 'dist', 'configs', 'webpack', 'config.js') fse.emptyDirSync(buildDirectory) execSync(`${webpack} --config ${webpackConf}`, { env: { diff --git a/packages/pwa-kit-dev/src/configs/webpack/config.js b/packages/pwa-kit-dev/src/configs/webpack/config.js index 31410ecd1d..2bc87e3a3e 100644 --- a/packages/pwa-kit-dev/src/configs/webpack/config.js +++ b/packages/pwa-kit-dev/src/configs/webpack/config.js @@ -512,7 +512,8 @@ const ssr = (() => { ...config.plugins, staticFolderCopyPlugin, analyzeBundle && getBundleAnalyzerPlugin(SSR) - ].filter(Boolean) + ].filter(Boolean), + devtool: 'source-map' } }) .build() From 8d171240ea758cae6c78b4e75b778ffeeb52e95b Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Tue, 28 Nov 2023 13:36:26 -0500 Subject: [PATCH 2/8] add script for ssr source map --- packages/pwa-kit-dev/src/configs/webpack/config.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/pwa-kit-dev/src/configs/webpack/config.js b/packages/pwa-kit-dev/src/configs/webpack/config.js index 2bc87e3a3e..9a0c92dd0a 100644 --- a/packages/pwa-kit-dev/src/configs/webpack/config.js +++ b/packages/pwa-kit-dev/src/configs/webpack/config.js @@ -498,8 +498,13 @@ const ssr = (() => { if (mode === production) { return baseConfig('node') .extend((config) => { + let additionalConfig = {} + if (process.env.SSR_SOURCE_MAP === 'true') { + additionalConfig = {devtool: 'source-map'} + } return { ...config, + ...additionalConfig, // Must *not* be named "server". See - https://www.npmjs.com/package/webpack-hot-server-middleware#usage name: SSR, entry: `.${EXT_OVERRIDES_DIR}/app/ssr.js`, @@ -512,8 +517,7 @@ const ssr = (() => { ...config.plugins, staticFolderCopyPlugin, analyzeBundle && getBundleAnalyzerPlugin(SSR) - ].filter(Boolean), - devtool: 'source-map' + ].filter(Boolean) } }) .build() From 077520b9bc226bbaa78ce155745263447083e606 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Tue, 28 Nov 2023 13:38:25 -0500 Subject: [PATCH 3/8] add script to package --- packages/pwa-kit-dev/bin/pwa-kit-dev.js | 2 +- packages/template-retail-react-app/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/pwa-kit-dev/bin/pwa-kit-dev.js b/packages/pwa-kit-dev/bin/pwa-kit-dev.js index 75e9ec07eb..2189cf36f1 100755 --- a/packages/pwa-kit-dev/bin/pwa-kit-dev.js +++ b/packages/pwa-kit-dev/bin/pwa-kit-dev.js @@ -238,7 +238,7 @@ const main = async () => { const projectWebpack = p.join(process.cwd(), 'webpack.config.js') const webpackConf = fse.pathExistsSync(projectWebpack) ? projectWebpack - : p.join(__dirname, '..', 'dist', 'configs', 'webpack', 'config.js') + : p.join(__dirname, '..', 'configs', 'webpack', 'config.js') fse.emptyDirSync(buildDirectory) execSync(`${webpack} --config ${webpackConf}`, { env: { diff --git a/packages/template-retail-react-app/package.json b/packages/template-retail-react-app/package.json index dd72453427..8f3c4474db 100644 --- a/packages/template-retail-react-app/package.json +++ b/packages/template-retail-react-app/package.json @@ -20,6 +20,7 @@ "lint:fix": "npm run lint -- --fix", "postinstall": "npm run compile-translations && npm run compile-translations:pseudo", "push": "npm run build && pwa-kit-dev push", + "push:source-map": "cross-env SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", "save-credentials": "pwa-kit-dev save-credentials", "start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start", "start:inspect": "npm run start -- --inspect", From 5507e8959e45148db49d44e5ec612a89c54918b6 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Tue, 28 Nov 2023 16:39:42 -0500 Subject: [PATCH 4/8] change script to ssr-source-map to be more specific --- packages/template-retail-react-app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/template-retail-react-app/package.json b/packages/template-retail-react-app/package.json index 8f3c4474db..e47cbd02fd 100644 --- a/packages/template-retail-react-app/package.json +++ b/packages/template-retail-react-app/package.json @@ -20,7 +20,7 @@ "lint:fix": "npm run lint -- --fix", "postinstall": "npm run compile-translations && npm run compile-translations:pseudo", "push": "npm run build && pwa-kit-dev push", - "push:source-map": "cross-env SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", + "push:ssr-source-map": "cross-env SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", "save-credentials": "pwa-kit-dev save-credentials", "start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start", "start:inspect": "npm run start -- --inspect", From c1828bf417b1440286719f3b10bbddedf5445731 Mon Sep 17 00:00:00 2001 From: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:49:29 -0500 Subject: [PATCH 5/8] Inline spread devtool property Co-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com> Signed-off-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> --- packages/pwa-kit-dev/src/configs/webpack/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pwa-kit-dev/src/configs/webpack/config.js b/packages/pwa-kit-dev/src/configs/webpack/config.js index 9a0c92dd0a..794b2e30ca 100644 --- a/packages/pwa-kit-dev/src/configs/webpack/config.js +++ b/packages/pwa-kit-dev/src/configs/webpack/config.js @@ -504,7 +504,7 @@ const ssr = (() => { } return { ...config, - ...additionalConfig, + ...(process.env.SSR_SOURCE_MAP === 'true' ? {devtool: 'source-map'} : {}), // Must *not* be named "server". See - https://www.npmjs.com/package/webpack-hot-server-middleware#usage name: SSR, entry: `.${EXT_OVERRIDES_DIR}/app/ssr.js`, From 16ddba75903d6fce1d2ae584e0db34bc5109c1e6 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Thu, 30 Nov 2023 14:12:01 -0500 Subject: [PATCH 6/8] cleanup and prevent ssr-source-map from running in ci --- packages/pwa-kit-dev/src/configs/webpack/config.js | 4 ---- scripts/smoke-test-npm-scripts.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/pwa-kit-dev/src/configs/webpack/config.js b/packages/pwa-kit-dev/src/configs/webpack/config.js index e49ae519b2..69933fc656 100644 --- a/packages/pwa-kit-dev/src/configs/webpack/config.js +++ b/packages/pwa-kit-dev/src/configs/webpack/config.js @@ -506,10 +506,6 @@ const ssr = (() => { if (mode === production) { return baseConfig('node') .extend((config) => { - let additionalConfig = {} - if (process.env.SSR_SOURCE_MAP === 'true') { - additionalConfig = {devtool: 'source-map'} - } return { ...config, ...(process.env.SSR_SOURCE_MAP === 'true' ? {devtool: 'source-map'} : {}), diff --git a/scripts/smoke-test-npm-scripts.js b/scripts/smoke-test-npm-scripts.js index 69459200a1..cac5ab8fa4 100644 --- a/scripts/smoke-test-npm-scripts.js +++ b/scripts/smoke-test-npm-scripts.js @@ -35,7 +35,7 @@ const main = () => { const exclude = [ /^lint.*$/, /^test.*$/, - /^push$/, + /^push.*$/, /^save-credentials$/, /^tail-logs$/, /^format$/, From 90793d49282b22fef747b62567d5be60a76e8350 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Thu, 30 Nov 2023 14:46:32 -0500 Subject: [PATCH 7/8] namespace env var PWA_KIT_SSR_SOURCE_MAP --- packages/pwa-kit-dev/src/configs/webpack/config.js | 4 +++- packages/template-retail-react-app/package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/pwa-kit-dev/src/configs/webpack/config.js b/packages/pwa-kit-dev/src/configs/webpack/config.js index 69933fc656..54634949cf 100644 --- a/packages/pwa-kit-dev/src/configs/webpack/config.js +++ b/packages/pwa-kit-dev/src/configs/webpack/config.js @@ -508,7 +508,9 @@ const ssr = (() => { .extend((config) => { return { ...config, - ...(process.env.SSR_SOURCE_MAP === 'true' ? {devtool: 'source-map'} : {}), + ...(process.env.PWA_KIT_SSR_SOURCE_MAP === 'true' + ? {devtool: 'source-map'} + : {}), // Must *not* be named "server". See - https://www.npmjs.com/package/webpack-hot-server-middleware#usage name: SSR, entry: `.${EXT_OVERRIDES_DIR}/app/ssr.js`, diff --git a/packages/template-retail-react-app/package.json b/packages/template-retail-react-app/package.json index 5b89f8e8b5..79d6085566 100644 --- a/packages/template-retail-react-app/package.json +++ b/packages/template-retail-react-app/package.json @@ -20,7 +20,7 @@ "lint:fix": "npm run lint -- --fix", "postinstall": "npm run compile-translations && npm run compile-translations:pseudo", "push": "npm run build && pwa-kit-dev push", - "push:ssr-source-map": "cross-env SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", + "push:ssr-source-map": "cross-env PWA_KIT_SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", "save-credentials": "pwa-kit-dev save-credentials", "start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start", "start:inspect": "npm run start -- --inspect", From d447b510316bf0c5b31f67fbdbf44ac1acccd7f8 Mon Sep 17 00:00:00 2001 From: yunakim714 Date: Thu, 28 Dec 2023 10:47:06 -0500 Subject: [PATCH 8/8] remove script --- packages/template-retail-react-app/package.json | 1 - scripts/smoke-test-npm-scripts.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/template-retail-react-app/package.json b/packages/template-retail-react-app/package.json index 79d6085566..9aadc7427d 100644 --- a/packages/template-retail-react-app/package.json +++ b/packages/template-retail-react-app/package.json @@ -20,7 +20,6 @@ "lint:fix": "npm run lint -- --fix", "postinstall": "npm run compile-translations && npm run compile-translations:pseudo", "push": "npm run build && pwa-kit-dev push", - "push:ssr-source-map": "cross-env PWA_KIT_SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", "save-credentials": "pwa-kit-dev save-credentials", "start": "cross-env NODE_ICU_DATA=node_modules/full-icu pwa-kit-dev start", "start:inspect": "npm run start -- --inspect", diff --git a/scripts/smoke-test-npm-scripts.js b/scripts/smoke-test-npm-scripts.js index cac5ab8fa4..69459200a1 100644 --- a/scripts/smoke-test-npm-scripts.js +++ b/scripts/smoke-test-npm-scripts.js @@ -35,7 +35,7 @@ const main = () => { const exclude = [ /^lint.*$/, /^test.*$/, - /^push.*$/, + /^push$/, /^save-credentials$/, /^tail-logs$/, /^format$/,