PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.31k stars 358 forks source link

[BUG] Typescript Import Attributes #987

Open GODrums opened 4 months ago

GODrums commented 4 months ago

What happened?

Using Typescript's import attributes leads to build errors in Plasmo.

With Typescript 5.3, import attributes have been introduced: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-3.html

🟣 Plasmo v0.86.3
πŸ”΄ The Browser Extension Framework
πŸ”΅ INFO   | Starting the extension development server...
πŸ”΅ INFO   | Loaded environment variables from: [ '.env.chrome', '.env' ]
πŸ”΄ ERROR  | Build failed. To debug, run plasmo dev --verbose.
πŸ”΄ ERROR  | Expected ';', got 'with'

or with plasmo dev --verbose

πŸ”΅ INFO   | Loaded environment variables from: [ '.env.chrome', '.env' ]
🟑 0      | @plasmohq/parcel-transformer-manifest
🟑 1      | Adding tab onboarding.tsx
🟑 2      | Adding icons
🟑 3      | Adding default_icon
🟑 4      | Adding default_popup
🟑 5      | Handling MV3 background service worker
🟑 6      | + Finished transforming manifest
πŸ”΄ ERROR  | Expected ';', got 'with'
🟑 30     | ...\src\lib\handlers\mappinghandler.ts:1:45

with the corresponding line mappinghandler.ts:1:45: import buffIds from '@/assets/buffids.json' with { type: "json" };

My package.json uses "typescript": "5.4.5".

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

No response

Relevant log output

No response

(OPTIONAL) Contribution

Code of Conduct

louisgv commented 3 months ago

I think the packaged Parcel's TS path resolver doesn't support TS import attributes atm xd...

If you can help with #813 that'd be great.