Skip to content

pg-manual: webpack mode hardcoded to 'development' — npm run build produces dev bundle #51

Description

@dobby-coder

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.jsonbuild / 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreRoutine maintenance

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions