-
Notifications
You must be signed in to change notification settings - Fork 303
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
Executing shopify hydrogen build --sourcemap, no corresponding .js.map file is generated. #1325
Comments
The command Sourcemaps are a bit special in Remix. They contain both frontend and backend code because it mixes loaders/actions/components in the same files. Therefore, having sourcemaps available in the browser would mean anyone could see your backend code, and that's why we don't provide them at the moment. |
Yes, I encountered this situation when operating GitHub. I need to obtain the sourcemap and upload it to the Alibaba Cloud front-end monitoring when operating GitHub. It is used to monitor online errors. I want to delete it myself after uploading it. Is there any way? |
I think that right now, the only way of doing this in the action is by adding an extra step/job in the GH workflow file after your site is deployed and build the project again. As long as you don't declare the We are going to change this behavior soon and always generate sourcemaps at the Hydrogen level, and simply ignore them in Oxygen. |
@Jerrylijieq This has been fixed in the last versions of |
Hi @frandiox the doc says tha the .map is generated by default. it works only for the server, client side js files haven't the source map https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-build |
@bitforcesrl Our build by default does not generate sourcemap for the browser when building for production. The reason is explained above:
That said, if you avoid hardcoding secrets (using the |
Source map is not generated for client assets
… On 27 Aug 2024, at 12:39, Fran Dios ***@***.***> wrote:
@bitforcesrl <https://github.com/bitforcesrl> Our build by default does not generate sourcemap for the browser when building for production. The reason is explained above <#1325 (comment)>:
Sourcemaps are a bit special in Remix. They contain both frontend and backend code because it mixes loaders/actions/components in the same files.
Therefore, having sourcemaps available in the browser would mean anyone could see your backend code, and that's why we don't provide them at the moment.
That said, if you avoid hardcoding secrets (using the env object instead) and you are OK with exposing your backend code to the browser, or if you are just going to upload them after build and then remove them before deploying... I think you can overwrite this option in your vite.config.js: https://vitejs.dev/config/build-options.html#build-sourcemap
Let me know if that doesn't work.
—
Reply to this email directly, view it on GitHub <#1325 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ALA3VTP2EUI7Y6AWH5D5K3LZTRJNHAVCNFSM6AAAAABNFVQGRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJSGE3DQNJRGE>.
You are receiving this because you were mentioned.
|
Fix here: #2477 |
vite flag is not read from the build Hello, we want to push client sourcemap on prod env, because we 'll not add any private data in client JS. we'll use env var for BE secrets vite config is not respected the flag: shopify hydrogen build --codegen --force-client-sourcemap What we should do to fix that? |
What is the location of your example repository?
https://github.com/Youniverse-FE/fezibo/actions/runs/6157700531/job/16708968253
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
"@shopify/cli-hydrogen": "^5.0.2",
What version of Remix are you using?
No response
Steps to Reproduce
Hydrogen deployment goes online and executes shopify hydrogen build --sourcemap. No .js.map file is generated, but when executed in the development environment, a .js.map file is generated. I need sourcemap to monitor online errors, but I can't get it now.
Expected Behavior
Execute shopify hydrogen build --sourcemap, and the corresponding .js.map file will be generated.
Actual Behavior
Executing shopify hydrogen build --sourcemap, no corresponding .js.map file is generated.
The text was updated successfully, but these errors were encountered: