Skip to content

fix(build): declare terser-webpack-plugin, restoring the production build - #142

Merged
rubenvdlinde merged 1 commit into
mainfrom
hotfix/restore-terser-webpack-plugin
Aug 3, 2026
Merged

fix(build): declare terser-webpack-plugin, restoring the production build#142
rubenvdlinde merged 1 commit into
mainfrom
hotfix/restore-terser-webpack-plugin

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Follow-up to #140. That PR fixed npm ci; release-stable now gets past it and fails on the next step, npm run build.

Failure

Run 30831246003npm ci succeeded (added 1197 packages), then:

[webpack-cli] Error: Cannot find module 'terser-webpack-plugin'
Require stack:
- node_modules/@nextcloud/webpack-vue-config/webpack.config.js
- node_modules/@nextcloud/webpack-vue-config/index.js
- webpack.config.js

Cause

@nextcloud/webpack-vue-config require()s terser-webpack-plugin without declaring it. It got away with that because webpack used to ship it:

webpack own dependencies
5.105.4 (previous lockfile) "terser-webpack-plugin": "^5.3.17"
5.109.2 (current lockfile) removed

Our range is "webpack": "^5.94.0", so regenerating the lockfile in #140 moved webpack 5.105.4 → 5.109.2 in range and the phantom dependency vanished with it.

This was latent before #140 only because npm ci never succeeded, so npm run build never ran.

Fix

Declare terser-webpack-plugin: ^5.3.17 as a devDependency.

We genuinely use it — via @nextcloud/webpack-vue-config's webpack config — so declaring it states a real dependency rather than working around one. It is also version-independent: a future in-range webpack bump cannot silently remove it again.

Pinning webpack back to 5.105.4 would restore the build too, but would leave the undeclared dependency in place to break on the next bump, and would freeze webpack for an unrelated reason.

+1 line in package.json, +62 in the lockfile. Nothing else moves — @nextcloud/axios stays 2.5.2, @conduction/nextcloud-vue stays 1.0.0-beta.101.

Verification

  • npm ci (npm 10) — succeeds, added 1305 packages
  • npm run buildexit 0, webpack 5.109.2 compiled with 2 warnings
  • npm run lint — exit 0, 0 errors (66 pre-existing @spec jsdoc warnings)

…uild

`release-stable` now gets past `npm ci` but fails the next step, `npm run build`:

    [webpack-cli] Error: Cannot find module 'terser-webpack-plugin'
    Require stack:
    - node_modules/@nextcloud/webpack-vue-config/webpack.config.js

@nextcloud/webpack-vue-config requires terser-webpack-plugin without declaring
it, and had been getting away with it because webpack shipped it: webpack
5.105.4 listed "terser-webpack-plugin": "^5.3.17" in its own dependencies.
webpack 5.109.2 removed it, so the phantom disappeared and the require broke.

Our range is "webpack": "^5.94.0", so the previous lockfile regeneration moved
webpack 5.105.4 -> 5.109.2 in range and took terser-webpack-plugin with it.

Declaring terser-webpack-plugin directly fixes the actual defect -- we do use
it, through @nextcloud/webpack-vue-config's config -- and is version
independent, so a future in-range webpack bump cannot silently remove it again.
Pinning webpack back would restore the build but leave the undeclared
dependency in place to break on the next bump.

Verified locally: npm ci (npm 10) succeeds, `npm run build` compiles (0 errors,
2 pre-existing warnings), and `npm run lint` still passes with 0 errors.
@rubenvdlinde
rubenvdlinde merged commit 138def3 into main Aug 3, 2026
44 of 54 checks passed
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/doriath @ 149b342

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
composer ✅ 102/102
npm ✅ 309/309
PHPUnit
Newman
Playwright ⏭️

Quality workflow — 2026-08-03 16:35 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde deleted the hotfix/restore-terser-webpack-plugin branch August 14, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant