Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import assertion get removed from output #714

Open
ivanhofer opened this issue Sep 11, 2022 · 1 comment
Open

import assertion get removed from output #714

ivanhofer opened this issue Sep 11, 2022 · 1 comment

Comments

@ivanhofer
Copy link

ivanhofer commented Sep 11, 2022

When bundling an 'esm' file that include import assertions, they are missing in the generated output.

Repo with reproduction: https://github.com/ivanhofer/tsup-import-assertion-bug

In /esbuild/index.js the import assertion are here, but in /tsup/index.mjs they are missing.

I would expect tsup to also include the import assertions in the generated output.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@await-ovo
Copy link
Contributor

await-ovo commented Nov 7, 2022

Hi, since tsup's default target is node14, so import assertions will finally be transformed. you can specify target to esnext according to esbuild's syntax features in tsup.config.ts:

import { defineConfig } from 'tsup'

export default defineConfig([
  {
    name: 'main',
    entry: ['./src/index.ts'],
    outDir: './tsup',
    format: ['esm'],
    target: 'esnext'
  }
])

Or config target in tsconfig.json(supported in v6.4.0)

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

No branches or pull requests

2 participants