build: migrate webpack to Vite 8 library mode (#42) - #54
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsfeatNextglobal 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, globaljsfeatNext, CJS-requireable (main)dist/jsfeatNext.mjs— new ESM build (module/import)types/— declarations only (fixed a real bug hit during this migration: vite-plugin-dts v5 renamedoutDir→outDirs; the old option name was silently ignored and declarations leaked intodist/src/**)package.jsongets a properexportsmap,fileswhitelist;prettier/ts-loaderalready lived indevDependencies(from chore(deps): upgrade dependencies + packaging-metadata fixes #53);@babel/runtimedropped entirely — no external runtime deps remaintsconfig 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)downlevelIteration/baseUrland an odd top-levelpathsmappinglibkey sat outsidecompilerOptions— a latent no-op bug, now fixedREADME
Replaced the stale "webpack bundler" bullet; added a Requirements & building section (Node version, commands, output shape).
Verification
tsc --noEmit→ cleannpm test→ 57 passedrequire(), simulated browser global, ESMimport, and consumer.d.tsresolution all checked against the pre-migration webpack baseline (VERSION 0.7.5,jsfeatNext.jsfeatNext.imgproc) — byte-for-byte shape match🤖 Generated with Claude Code