Skip to content

build: migrate webpack to Vite 8 library mode (#42) - #54

Merged
kalwalt merged 1 commit into
devfrom
build/vite-migration
Jul 7, 2026
Merged

build: migrate webpack to Vite 8 library mode (#42)#54
kalwalt merged 1 commit into
devfrom
build/vite-migration

Conversation

@kalwalt

@kalwalt kalwalt commented Jul 7, 2026

Copy link
Copy Markdown
Member

Closes #42. Guarded by the parity suite (Phase 0, #39/#49) — all 57 tests must stay green with the new toolchain.

Summary

Replaces webpack + babel-loader + ts-loader + @babel/* with Vite library mode + vite-plugin-dts. Toolchain bumped to latest: vite 8.1.3, vitest 4.1.10, vite-plugin-dts 5.0.3, typescript 6.0.3 (vitest 4's peer range explicitly allows Vite 8).

Non-breaking by design: the UMD output keeps the exact jsfeatNext.jsfeatNext global shape the examples and existing consumers rely on. The double-namespace itself is a deliberate breaking-change candidate, deferred to #41.

Build output

  • dist/jsfeatNext.js — UMD, global jsfeatNext, CJS-requireable (main)
  • dist/jsfeatNext.mjsnew ESM build (module / import)
  • types/ — declarations only (fixed a real bug hit during this migration: vite-plugin-dts v5 renamed outDiroutDirs; the old option name was silently ignored and declarations leaked into dist/src/**)
  • package.json gets a proper exports map, files whitelist; prettier/ts-loader already lived in devDependencies (from chore(deps): upgrade dependencies + packaging-metadata fixes #53); @babel/runtime dropped entirely — no external runtime deps remain

tsconfig modernized for TS 6

TS 6 turns several old options into hard errors:

  • moduleResolution: "bundler", target: "ES2020", lib: ["ESNext", "DOM"]
  • noEmit: true (Vite/esbuild builds the JS now; tsc is typecheck-only)
  • Removed deprecated downlevelIteration/baseUrl and an odd top-level paths mapping
  • The old top-level lib key sat outside compilerOptions — a latent no-op bug, now fixed

README

Replaced the stale "webpack bundler" bullet; added a Requirements & building section (Node version, commands, output shape).

Verification

  • tsc --noEmit → clean
  • npm test57 passed
  • UMD require(), simulated browser global, ESM import, and consumer .d.ts resolution all checked against the pre-migration webpack baseline (VERSION 0.7.5, jsfeatNext.jsfeatNext.imgproc) — byte-for-byte shape match

🤖 Generated with Claude Code

Replace webpack + babel-loader + ts-loader + @babel/* with Vite library mode + vite-plugin-dts.

Toolchain upgraded to latest (vitest 4's peer range allows Vite 8):
- vite 8.1.3, vitest 4.1.10, vite-plugin-dts 5.0.3, typescript 6.0.3

tsconfig modernized for TS 6 + Vite (TS 6 turns the old options into hard errors):
- moduleResolution 'bundler', target ES2020, lib [ESNext, DOM]
- noEmit: true (Vite/esbuild does the JS build now; tsc is typecheck-only)
- removed deprecated downlevelIteration/baseUrl and the odd top-level paths mapping
- the old top-level 'lib' key (outside compilerOptions) was a latent no-op bug, now fixed

vite.config.mts:
- dts plugin uses outDirs (renamed from outDir in v5/unplugin-dts) -> types/, so
  declarations land only under types/ and NOT under dist/ alongside the JS bundle

Output (non-breaking):
- UMD dist/jsfeatNext.js: global 'jsfeatNext' exposing the default export, so
  'jsfeatNext.jsfeatNext' and the examples keep working; also CJS-requireable (main)
- NEW ESM dist/jsfeatNext.mjs (module / import)
- package.json: exports map (types/import/require), module field, files whitelist;
  dropped @babel/runtime (no external runtime deps remain)

README: replace the 'webpack bundler' feature bullet and add a Requirements &
building section (Node version, build/watch/test commands, output shape).

Deferred to #41: the jsfeatNext.jsfeatNext double-namespace itself (breaking
change, out of scope for this build-only migration).

Verified: tsc --noEmit clean; npm test 57 passed; UMD require, browser global
simulation, ESM import, and consumer .d.ts resolution all checked and match the
webpack baseline (VERSION 0.7.5, jsfeatNext.jsfeatNext.imgproc).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kalwalt kalwalt added this to the Parity & Modernization milestone Jul 7, 2026
@kalwalt kalwalt self-assigned this Jul 7, 2026
@kalwalt kalwalt added enhancement New feature or request Typescript all about Typescript dependencies Pull requests that update a dependency file Vite bundler labels Jul 7, 2026
@kalwalt
kalwalt merged commit 45ea746 into dev Jul 7, 2026
4 checks passed
@kalwalt
kalwalt deleted the build/vite-migration branch July 7, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request Typescript all about Typescript Vite bundler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant