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

typescript rollup config with node 22 fails with "Unexpected identifier 'assert'" #1762

Open
michaelglass opened this issue Aug 29, 2024 · 0 comments

Comments

@michaelglass
Copy link

michaelglass commented Aug 29, 2024

Expected Behavior

on Node V22, the keyword assert has been replaced with with,
when my rollup.config.ts includes an import using with

import pkg from "./package.json" with { type: "json" };

npx rollup -c --pluginConfig typescript
will run rollup

Actual Behavior

I get the error,

[!] SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:164:18)
    at callTranslator (node:internal/modules/esm/loader:439:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:445:30)
    at async ModuleJob._link (node:internal/modules/esm/module_job:106:19)

I get the same error when passing the tsconfig manually to rollup, e.g.
npx rollup -c --configPlugin typescript={target:\"esnext\"\,module:\"Preserve\"}

Additional Information

clone the repo above to see a small reproduction

git clone [email protected]:michaelglass/rollup-typescript-repro.git
cd rollup-typescript-repro
direnv allow # if you're using nix / direnv, or nix develop
npm install
npm run rollup-ts
michaelglass added a commit to nlxai/sdk that referenced this issue Aug 29, 2024
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

1 participant