Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"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",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you "align" the name of this script with the others?

  • serve:* → only starts the server
  • build:* → only builds
  • start:* → builds and starts immediately after

Maybe we could use two scripts for this:

  • build:prod:debug
  • start: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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ybnd: following your recommendations, I've adjusted the commands to match the existing standard naming convention:

build:prod:debug: builds the dist with the debug parameter
start:prod:debug: builds and starts with the debug parameter

"analyze": "webpack-bundle-analyzer dist/browser/stats.json",
"build": "ng build --configuration development",
"build:stats": "ng build --stats-json",
Expand Down
5 changes: 5 additions & 0 deletions webpack/webpack.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { EnvironmentPlugin } from 'webpack';
import { projectRoot } from './helpers';
import { commonExports } from './webpack.common';

const SSR_DEBUG = process.env.SSR_DEBUG === 'true';

module.exports = Object.assign({}, commonExports, {
plugins: [
...commonExports.plugins,
Expand All @@ -14,6 +16,9 @@ module.exports = Object.assign({}, commonExports, {
}),
],
mode: 'production',
optimization: {
minimize: !SSR_DEBUG,
},
recordsOutputPath: projectRoot('webpack.records.json'),
entry: projectRoot('./server.ts'),
target: 'node',
Expand Down
Loading