Disable server bundle minification#5330
Conversation
|
Marking as Reviewer approved due to the testing done by @alegontarz. |
ybnd
left a comment
There was a problem hiding this comment.
I can confirm that this solves the original issue.
|
@oscar-escire and @ybnd : While I can understand the reason behind this PR, I'm a little concerned that this change in minification drastically increases the size of While I understand it's very useful for debugging, I'm a little worried this will have performance impacts because of the size increase (even though I realize this The alternative would be to find a way to make this more configurable. Sites could then choose to enable it or enable temporarily when they are debugging a specific issue. |
|
@tdonohue and @ybnd: I've tested a few alternatives for this PR, but in the end, the best option is still to use |
ybnd
left a comment
There was a problem hiding this comment.
The environment variable is a good idea, only some small notes on the Node scripts
| "preserve": "npm run base-href", | ||
| "serve": "ts-node -r tsconfig-paths/register --project ./tsconfig.ts-node.json scripts/serve.ts", | ||
| "serve:ssr": "node dist/server/main", | ||
| "serve:ssr:debug": "SSR_DEBUG=true npm run build:ssr && node dist/server/main", |
There was a problem hiding this comment.
Could you "align" the name of this script with the others?
serve:*→ only starts the serverbuild:*→ only buildsstart:*→ builds and starts immediately after
Maybe we could use two scripts for this:
build:prod:debugstart:prod:debug
We may also need the cross-env NODE_ENV=production part for other parts of the code to properly recognize that it is running in production mode?
References
Description
Disable minification for the server-side webpack bundle to produce readable error stack traces in production.
Instructions for Reviewers
throw new Error('hello world')anywhere in the body ofserver.tsto simulate an uncaught erroryarn build:prodyarn serve:ssrList of changes in this PR:
optimization: { minimize: false }towebpack/webpack.prod.tsto disable minification ofdist/server/main.jsNotes:
mode: 'production'is preserved, so tree-shaking and other production optimizations remain activewebpack.browser.ts) is unaffected and remains minifiedChecklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.