-
Notifications
You must be signed in to change notification settings - Fork 144
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
Conversation
@@ -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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
@@ -498,8 +498,13 @@ const ssr = (() => { | |||
if (mode === production) { | |||
return baseConfig('node') | |||
.extend((config) => { | |||
let additionalConfig = {} | |||
if (process.env.SSR_SOURCE_MAP === 'true') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (process.env.SSR_SOURCE_MAP === 'true') { | |
if (process.env.PWA_KIT_SSR_SOURCE_MAP === 'true') { |
Namespacing env vars is good/consistent 🙂
Co-authored-by: Will Harney <[email protected]> Signed-off-by: Yuna Kim <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will's point about namespacing is not wrong, but not a blocker
@@ -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:ssr-source-map": "cross-env PWA_KIT_SSR_SOURCE_MAP=true npm run build && pwa-kit-dev push", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"push:ssr-source-map": "cross-env PWA_KIT_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 push", |
This actually makes me wonder, though, what is the point of having a specific npm script for this? Why not just document the feature and let people set the environment variable when they want to use it?
Another idea: We could add a flag to pwa-kit-dev build
, copying the pattern for the buildDirectory flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed with Will on point of having this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wjhsf @alexvuong Will get back to this once I have approval on a new tech proposal from the platform MRT team.
@bfeister @alexvuong @wjhsf New implementation of enabling source maps will be merged with this PR. Users will be able to toggle the Based on this implementation, I agree that we do not really need the script, but just documentation on the env var used in |
…ud/pwa-kit into enable-source-maps
npm run push:source-map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor caveat: we should have a documentation update that exposes this to customers, but not a blocker for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🚢 🚢
Description
W-14148180
In order to improve the readability of server-side errors in MRT logs, we need to generate and output a source map as part of the bundle. This PR aims to write a new script so that customers can generate this file,
ssr.js.map
, only when they run the script:npm run push:ssr-source-map
. This file will not be publicly exposed or available to download.In order to then enable source maps in Cloud Watch logs, we need to set the environment variable,
NODE_OPTIONS=--enable-source-maps
in AWS Lambda.Types of Changes
Changes
npm run push:ssr-source-map
that runs build with the environment variableSSR_SOURCE_MAP
SSR_SOURCE_MAP
is set totrue
then build will generate and output assr.js.map
file as part of the bundleHow to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization