Skip to content

fix: publish user-facing tsconfig.json for backward compatibility#1351

Open
itxaiohanglover wants to merge 1 commit into
PlasmoHQ:mainfrom
itxaiohanglover:fix/tsconfig-compat
Open

fix: publish user-facing tsconfig.json for backward compatibility#1351
itxaiohanglover wants to merge 1 commit into
PlasmoHQ:mainfrom
itxaiohanglover:fix/tsconfig-compat

Conversation

@itxaiohanglover

Copy link
Copy Markdown

Summary

  • plasmo/tsconfig.json exists in the source repo 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 Failed to resolve '../../popup.tsx' from './.plasmo/static/popup.tsx' because Parcel silently fails when the extended tsconfig doesn't exist, breaking module resolution
  • The correct path "plasmo/templates/tsconfig.base" works fine, but plasmo/tsconfig.json should also work for backward compatibility

Changes (minimal)

  1. Rename cli/plasmo/tsconfig.jsoncli/plasmo/tsconfig.build.json (internal build config, unchanged content)
  2. Create new cli/plasmo/tsconfig.json with { "extends": "./templates/tsconfig.base.json" } (user-facing alias)
  3. Update cli/plasmo/package.json:
    • Add "tsconfig.json" to files array (so it gets published)
    • Update lint:type and type scripts to reference tsconfig.build.json

Root Cause Analysis

Tested with Plasmo 0.90.5 on Node 18/22 — confirmed that "extends": "plasmo/tsconfig.json" causes the build failure, and changing to "extends": "plasmo/templates/tsconfig.base" fixes it. The create-plasmo CLI already generates the correct path, but many existing projects use the old path.

Fixes #1040

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 PlasmoHQ#1040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 🔴 ERROR | Failed to resolve '../../popup.tsx' from './.plasmo/static/popup.tsx'

1 participant