0a774ddc8c
`vite build` is a browser-first bundler, so producing a runnable Node program from it meant constantly overriding its defaults (platform, externalization, inlineDynamicImports, module-preload). Building a Node app is a Node bundler's job — so split vue-tui's two jobs across two tools: - @vue-tui/vite is now DEV-ONLY (in-terminal dev server + HMR). Removed buildConfigPlugin and the externalize predicate: deleted src/build.ts, src/external.ts (+ external.spec.ts) and test/build.sequential.test.ts. vueTui() returns just the dev + dev-vmod plugins, and entry normalization is dev-only; dev.spec.ts updated. - Production builds move to tsdown + unplugin-vue: a plain tsdown.config.ts that bundles the whole app into one self-contained Node file (dist/*.mjs) runnable with no node_modules. platform:node keeps builtins external and emits a real createRequire for CJS deps; deps.alwaysBundle inlines everything else. - Migrated all five examples to tsdown (including flappy-bird, which hand-rolled a vite lib-mode self-contained build), and rewrote the examples smoke suite to build via tsdown and launch each self-contained bundle from an empty sandbox. - Added tsdown + unplugin-vue-jsx to the catalog; updated the root and @vue-tui/vite READMEs. BREAKING CHANGE: @vue-tui/vite no longer configures `vite build`. Build the app with tsdown instead (see the @vue-tui/vite README, examples/*, and the starter).
17 lines
800 B
TypeScript
17 lines
800 B
TypeScript
import { defineConfig } from "tsdown";
|
|
import Vue from "unplugin-vue/rolldown";
|
|
|
|
// Production build: bundle the whole app into one self-contained Node file (dist/main.mjs) that
|
|
// `node` runs with no node_modules present. `platform: "node"` keeps Node builtins external and
|
|
// emits a real createRequire for CJS deps; `deps.alwaysBundle` inlines everything else (tsdown
|
|
// externalizes declared deps by default, the library behavior); `onlyBundle: false` silences the
|
|
// resulting "you are bundling dependencies" hint (intentional for an app). Dev/HMR is separate —
|
|
// it runs through vite + @vue-tui/vite (see vite.config.ts).
|
|
export default defineConfig({
|
|
entry: ["src/main.ts"],
|
|
platform: "node",
|
|
format: "esm",
|
|
deps: { alwaysBundle: [/./], onlyBundle: false },
|
|
plugins: [Vue()],
|
|
});
|