Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate SSR source map with environment variable #1571

Merged
merged 13 commits into from
Jan 3, 2024
Merged
5 changes: 5 additions & 0 deletions packages/pwa-kit-dev/src/configs/webpack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,13 @@ const ssr = (() => {
if (mode === production) {
return baseConfig('node')
.extend((config) => {
let additionalConfig = {}
if (process.env.SSR_SOURCE_MAP === 'true') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (process.env.SSR_SOURCE_MAP === 'true') {
if (process.env.PWA_KIT_SSR_SOURCE_MAP === 'true') {

Namespacing env vars is good/consistent 🙂

additionalConfig = {devtool: 'source-map'}
}
return {
...config,
...additionalConfig,
yunakim714 marked this conversation as resolved.
Show resolved Hide resolved
// 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`,
Expand Down
1 change: 1 addition & 0 deletions packages/template-retail-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say push:ssr-source-map to be specific

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, said the opposite over here, but I'm unclear on the "why" behind this

#1571 (comment)

"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",
Expand Down
Loading