Problem
pg-manual/webpack.config.js:7 hardcodes:
const webpackMode = 'development'
mode is passed directly to webpack with no override path, so npm run build always produces a development bundle:
- No minification
- Cheap source maps embedded
process.env.NODE_ENV not set to 'production' for libraries that branch on it
There is no way to produce a production build of pg-manual today.
Suggested fix
Honour NODE_ENV (and/or webpack's --mode CLI flag) so npm run build defaults to production while npm run dev (webpack-dev-server) stays on development.
One small change:
const webpackMode = process.env.NODE_ENV === 'development' ? 'development' : 'production'
…and let webpack-dev-server set NODE_ENV=development itself (it does by default), or invoke it as cross-env NODE_ENV=development webpack serve in the dev script. Alternatively pass --mode from each npm script and remove the mode field entirely.
Verify with the existing dep-bump build check (pg-manual: npm install && npm run build must compile cleanly with zero export … was not found warnings) — see the build-and-bump-gotchas note.
Files
pg-manual/webpack.config.js:7 — the hardcoded constant
pg-manual/package.json — build / dev npm scripts may also need tweaking depending on which approach is taken
Scope
pg-manual only. pg-sveltekit's Vite build and pg-node's Node script are unaffected.
Problem
pg-manual/webpack.config.js:7hardcodes:modeis passed directly to webpack with no override path, sonpm run buildalways produces a development bundle:process.env.NODE_ENVnot set to'production'for libraries that branch on itThere is no way to produce a production build of
pg-manualtoday.Suggested fix
Honour
NODE_ENV(and/or webpack's--modeCLI flag) sonpm run builddefaults to production whilenpm run dev(webpack-dev-server) stays on development.One small change:
…and let webpack-dev-server set
NODE_ENV=developmentitself (it does by default), or invoke it ascross-env NODE_ENV=development webpack servein thedevscript. Alternatively pass--modefrom each npm script and remove themodefield entirely.Verify with the existing dep-bump build check (
pg-manual: npm install && npm run buildmust compile cleanly with zeroexport … was not foundwarnings) — see the build-and-bump-gotchas note.Files
pg-manual/webpack.config.js:7— the hardcoded constantpg-manual/package.json—build/devnpm scripts may also need tweaking depending on which approach is takenScope
pg-manualonly.pg-sveltekit's Vite build andpg-node's Node script are unaffected.