From f08f1d1cfbda9ca9b25ec2c0accbaf60a1c014d7 Mon Sep 17 00:00:00 2001 From: itxaiohanglover <1531137510@qq.com> Date: Fri, 10 Jul 2026 10:37:11 +0800 Subject: [PATCH] fix: publish user-facing tsconfig.json for backward compatibility The `plasmo/tsconfig.json` file exists in the source but is not included in the `files` field of package.json, so it's not published to npm. Users following older docs/tutorials that use `"extends": "plasmo/tsconfig.json"` get a "Failed to resolve '../../popup.tsx'" build error because Parcel cannot find the non-existent tsconfig, breaking module resolution. Fix: - Rename internal build tsconfig to `tsconfig.build.json` - Create user-facing `tsconfig.json` that re-exports `templates/tsconfig.base.json` - Add `tsconfig.json` to the `files` array so it gets published - Update build scripts to reference `tsconfig.build.json` Fixes #1040 --- cli/plasmo/package.json | 7 ++++--- cli/plasmo/tsconfig.build.json | 20 ++++++++++++++++++++ cli/plasmo/tsconfig.json | 21 +-------------------- 3 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 cli/plasmo/tsconfig.build.json diff --git a/cli/plasmo/package.json b/cli/plasmo/package.json index c4c308ae0..6e82f9824 100644 --- a/cli/plasmo/package.json +++ b/cli/plasmo/package.json @@ -13,15 +13,16 @@ "bin/index.mjs", "dist/index.js", "dist/type.d.ts", - "templates" + "templates", + "tsconfig.json" ], "scripts": { "dev": "node index.mjs -w", "build": "node index.mjs", - "type": "tsup src/type.ts --format esm --dts-only --dts-resolve", + "type": "tsup src/type.ts --format esm --dts-only --dts-resolve --tsconfig tsconfig.build.json", "prepublishOnly": "run-p type build", "lint": "run-p lint:*", - "lint:type": "tsc --noemit", + "lint:type": "tsc --noemit -p tsconfig.build.json", "lint:code": "eslint src/**/*.ts" }, "author": "Plasmo Corp. ", diff --git a/cli/plasmo/tsconfig.build.json b/cli/plasmo/tsconfig.build.json new file mode 100644 index 000000000..06e780bb2 --- /dev/null +++ b/cli/plasmo/tsconfig.build.json @@ -0,0 +1,20 @@ +{ + "extends": "@plasmo/config/ts/framework.json", + "include": [ + "src/**/*.ts", + "templates/plasmo.d.ts", + "templates/static/**/*.ts", + "templates/static/**/*.tsx" + ], + "exclude": ["dist", "node_modules"], + "compilerOptions": { + "outDir": "dist", + "baseUrl": ".", + "lib": ["es2022", "dom"], + "jsx": "preserve", + "paths": { + "~*": ["./src/*"], + "@plasmo-static-common/*": ["./templates/static/common/*"] + } + } +} diff --git a/cli/plasmo/tsconfig.json b/cli/plasmo/tsconfig.json index 06e780bb2..08f245d34 100644 --- a/cli/plasmo/tsconfig.json +++ b/cli/plasmo/tsconfig.json @@ -1,20 +1 @@ -{ - "extends": "@plasmo/config/ts/framework.json", - "include": [ - "src/**/*.ts", - "templates/plasmo.d.ts", - "templates/static/**/*.ts", - "templates/static/**/*.tsx" - ], - "exclude": ["dist", "node_modules"], - "compilerOptions": { - "outDir": "dist", - "baseUrl": ".", - "lib": ["es2022", "dom"], - "jsx": "preserve", - "paths": { - "~*": ["./src/*"], - "@plasmo-static-common/*": ["./templates/static/common/*"] - } - } -} +{"extends": "./templates/tsconfig.base.json"}