unjs / unbuild

📦 A unified JavaScript build system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import assertions are lost

JohnCampionJr opened this issue · comments

Environment

Node 18

Reproduction

Put a JSON import with an assertion to a TS file and run unbuild

Describe the bug

import pkg from 'npm-package/package.json' assert { type: "json" }

loses the assert and becomes

import pkg from 'npm-package/package.json'

Additional context

Note that package.json is actually exported by the package I'm using. It works fine otherwise.

ESBuild leaves it alone as expected in ESM formats.

Logs

No response

This is a low priority and can be closed if you don't want to fix; I found an alternate way to accomplish what I was looking to do :)