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

Deprecated Import Assert in Node.js 22 #228

Open
threeal opened this issue Sep 9, 2024 · 2 comments
Open

Deprecated Import Assert in Node.js 22 #228

threeal opened this issue Sep 9, 2024 · 2 comments

Comments

@threeal
Copy link

threeal commented Sep 9, 2024

  • Version: 3.4.5
  • Rollup Version: 4.21.2
  • Operating System and version (if applicable):
  • Node Version (if applicable): v22.7.0
  • Does it work with tsc (if applicable):

Reproduction

Import rollup-plugin-ts using ESM, either in rollup.config.js or anywhere like this:

import ts from "rollup-plugin-ts";

This issue seems related to rollup/rollup#5531.

Expected Behavior

Should import normally, in the case of Rollup, it should bundle file successfully.

Actual Behavior

When bundle file using Rollup:

[!] SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
    at callTranslator (node:internal/modules/esm/loader:436:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:30)

When imported in any JavaScript file:

import * as compatData from '@mdn/browser-compat-data' assert { type: 'json' };
                                                       ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
    at callTranslator (node:internal/modules/esm/loader:436:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:30)

Node.js v22.7.0
@NullVoxPopuli
Copy link

Looks like it's from here:

❯ ag -u "' assert {" -G ".js$"
node_modules/.pnpm/[email protected]/node_modules/browserslist-generator/dist/esm/index.js
3:import * as compatData from '@mdn/browser-compat-data' assert { type: 'json' };

@NullVoxPopuli
Copy link

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