kolibri-build 1.1.5: minify with terser-webpack-plugin 5.6.1 and resolve `style-loader` under pnpm
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
kolibri-build 1.1.4 has two bugs that projects installing it with pnpm hit, and Kolibri Data Portal carries a workaround for each: prod fails to minify every bundle when terser-webpack-plugin resolves to 5.6.1, and dev --hot cannot resolve style-loader. Both should be fixed and released as kolibri-build 1.1.5.
Complexity: Low Target branch: develop
Context
-
kolibri-build passes
terserOptions.outputtoTerserPlugin.swcMinify(webpack.config.base.js#L137-L146). terser-webpack-plugin 5.6.1, which 1.1.4's^5.3.16range allows, adds aformatkey beside it, and swc treatsoutputas an alias offormat, so every bundle fails:[ERROR: Kolibri Build] Failed to compile 'kolibri_data_portal.side_nav' bundle! kolibri_data_portal.side_nav-26.11.10.1534.js from Terser plugin duplicate field `format` at line 1 column 103 -
The
--hotCSS loader is the bare string'style-loader'(#L20), while every other loader usesrequire.resolve. pnpm puts kolibri-build's ownstyle-loaderin.pnpm/kolibri-build@…/node_modules/, whichresolveLoader.modulesdoes not search (#L165-L175). -
KDP pins
kolibri-build>terser-webpack-pluginto 5.3.16 inpnpm.overrides, and adds a rootstyle-loaderdevDependency (learningequality/kolibri-data-portal#1247). learningequality/kolibri-data-portal#1244 removes both once the fix ships.
The Change
- kolibri-build's swc minifier options should work whichever terser-webpack-plugin 5.x the project resolves.
- The
--hotCSS loader should resolve from kolibri-build's own dependencies, like the other loaders.
How to Get There
- In a kolibri-data-portal checkout of
develop, remove theterser-webpack-pluginoverride and the rootstyle-loaderdevDependency, then runpnpm install. - Confirm
pnpm-lock.yamlresolves kolibri-build'sterser-webpack-pluginto 5.6.1, then runpnpm run build. It fails withduplicate field `format`. - Run
kolibri-build dev --plugins <plugin> --hot. It fails withCan't resolve 'style-loader'.
Acceptance Criteria
- [ ]
kolibri-build prodbuilds KDP with terser-webpack-plugin 5.6.1 and with 5.3.16, and the minified bundles contain no comments. - [ ]
kolibri-build dev --hotbuilds a plugin in a pnpm project with no rootstyle-loader. - [ ] Non-hot
devbuilds are unchanged. - [ ]
packages/kolibri-build/package.jsonis at 1.1.5.
AI usage
Claude Code (rtibblesbot) hit the minifier failure while working on learningequality/kolibri-data-portal#1234, and Claude Code found the style-loader failure while reviewing a KDP branch. I chose to fix both in one kolibri-build 1.1.5 release, and Claude Code merged the two reports into this task.
Merged #15812 into this issue: one PR fixes the minifier options and the --hot style-loader resolution, and bumps kolibri-build to 1.1.5.
Plan: kolibri-build minifies under terser-webpack-plugin 5.3.16 and 5.6.1, resolves style-loader itself under --hot, and is versioned 1.1.5.
- [ ] Minifier options that every terser-webpack-plugin 5.x accepts
- [ ]
--hotCSS loader resolved from kolibri-build - [ ] Version 1.1.5, verified against KDP
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- Kolibri's lock moves kolibri-build's
terser-webpack-pluginto 5.6.1, so Kolibri's own build and the new spec run on it; if unwanted, the lock hunk and the minifier spec both go (on 5.3.16 the spec passes withoutput, an emptyformator noextractComments), and only the KDP rig covers 5.6.1. - The production compile runs in Jest's jsdom environment within an explicit timeout, as the planning session measured (6.7 s); this review could not re-run it (no
node_modulesin the worktree). If it fails there, the spec goes and the KDP rig plus Task 3's one-plugin Kolibriprodbuild carry the minifier criterion. - Where the session cannot bind a port, compiling the
dev --hotconfig without the dev server is the evidence for the--hotcriterion; if a served run is required, that criterion needs a host that allows the bind.
Written by rtibblesbot, an LLM-based coding agent.