e5015b0a80
* fix(vite): resolve @vue-tui/vite from CommonJS Vite configs
When a consumer project is CommonJS — package.json "type": "commonjs", or
no "type" field at all (Node defaults to CommonJS) — Vite loads vite.config.ts
as CommonJS and resolves its imports under the `require` condition.
@vue-tui/vite's exports used an `import`-only conditions object with no
fallback, so nothing matched under `require` and Vite threw:
[plugin externalize-deps] Failed to resolve "@vue-tui/vite".
This package is ESM only but it was tried to load by `require`.
Switch the export to a bare string (plus "./package.json"), matching the
other @vue-tui/* packages and @vitejs/plugin-vue. A string export is
condition-agnostic, so it resolves under both `import` and `require`; Node
then loads the ESM file via require(ESM), which every supported Node
(>=22.18) provides. No CommonJS build is added — this mirrors how the Vite
plugin ecosystem ships today (all ESM-only).
Add a regression test (test/cjs-config.test.ts): a `type: commonjs` fixture
whose vite.config.ts imports @vue-tui/vite by name, loaded through the real
config loader via resolveConfig(). It fails with the exact #238 error on the
old exports and passes with this change.
* chore(lint): exclude test fixtures from linting
Test fixtures are test INPUTS, not shipped source, and some are deliberately
broken: the overlay / full-reload dev-server tests transiently overwrite a
fixture's app.vue with a syntax error (to exercise the error overlay / failed
HMR), then restore it. Because `vp run ci` runs lint concurrently with those
tests, a linter that read a fixture inside that broken window failed with a
spurious "Unexpected token" — a flaky race whose surfacing depended on test
timing. Add lint.ignorePatterns ["**/test/fixtures/**"] to remove the race
(and the wasted lint work on test data).
49 lines
1.1 KiB
JSON
49 lines
1.1 KiB
JSON
{
|
|
"name": "@vue-tui/vite",
|
|
"version": "0.2.0",
|
|
"description": "Vite plugin for vue-tui: in-process terminal dev server with HMR + production build.",
|
|
"license": "MIT",
|
|
"files": [
|
|
"dist",
|
|
"LICENSE",
|
|
"README.md"
|
|
],
|
|
"type": "module",
|
|
"exports": {
|
|
".": "./dist/index.mjs",
|
|
"./package.json": "./package.json"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public"
|
|
},
|
|
"scripts": {
|
|
"build": "vp pack",
|
|
"dev": "vp pack --watch",
|
|
"test": "vp test --passWithNoTests",
|
|
"check:type": "tsc --noEmit",
|
|
"prepublishOnly": "vp run build"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "catalog:",
|
|
"@vitejs/plugin-vue": "^6",
|
|
"@vitejs/plugin-vue-jsx": "catalog:",
|
|
"@vue-tui/runtime": "workspace:*",
|
|
"typescript": "^6.0.3",
|
|
"vite": "catalog:",
|
|
"vue": "^3.4.0"
|
|
},
|
|
"peerDependencies": {
|
|
"@vitejs/plugin-vue": "^6",
|
|
"@vue-tui/runtime": "workspace:^",
|
|
"vite": "^8"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"@vitejs/plugin-vue": {
|
|
"optional": true
|
|
},
|
|
"vite": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|