Error with import assertions in rollup.config.ts
: SyntaxError: Unexpected identifier 'assert'
#474
Labels
scope: configPlugin
Related to usage as a configPlugin for reading rollup.config.ts (vs. regular plugin)
Summary
Running
rollup -c --configPlugin=typescript2
withrollup.config.ts:
under Node 22.9.0 produces
Repro: https://github.com/earshinov/repro-rollup-import-assertion
Troubleshooting
tsc
have the same output?No,
tsc
doesn't have the problemYes
https://github.com/earshinov/repro-rollup-import-assertion
What happens and why it is incorrect
I resumed working on one of my older projects, ran it under Node 22 and discovered that Rollup + rollup-plugin-typescript2 are no longer able to process my
rollup.config.ts
, where I hadimport pkg from './package.json' assert { type: 'json' }
.I converted this import into
import pkg from './package.json' with { type: 'json' };
as expected by the ECMAScript standard and Node 22, but the problem persisted.Upgrading Rollup and rollup-plugin-typescript2 didn't help.
Typescript itself (
tsc
) has no problems with transpilingrollup.config.ts
whatsoever.Environment
Copying
package.json
from the test repo:Windows 11.
Versions
:rollup.config.ts
:tsconfig.json
:tsconfig.dev.json
:package.json
plugin output with verbosity 3
:The text was updated successfully, but these errors were encountered: