Skip to content

Conversation

@karlhorky
Copy link
Member

@karlhorky karlhorky commented Sep 9, 2024

Linting on Node.js v22.8.0 led to the following ERR_IMPORT_ATTRIBUTE_MISSING error:

TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///home/runner/work/preflight/preflight/package.json" needs an import attribute of "type: json"
    at validateAttributes (node:internal/modules/esm/assert:88:15)
    at defaultLoad (node:internal/modules/esm/load:133:3)
    at async ModuleLoader.load (node:internal/modules/esm/loader:567:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:45)
    at async ModuleJob._link (node:internal/modules/esm/module_job:106:19)
 ELIFECYCLE  Command failed with exit code 2.

I needed to switch from the assert keyword to the with keyword in the dynamic import, because the "import assertions" proposal (using the assert keyword) changed to the "import attributes" proposal (using the with keyword).

The old "import assertions" proposal has been renamed to "import attributes" with the following major changes:

  1. The keyword is now with instead of assert.
  2. Unknown assertions cause an error rather than being ignored.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 9, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@karlhorky karlhorky merged commit e400b48 into main Sep 9, 2024
@karlhorky karlhorky deleted the switch-import-assertion-to-import-attribute branch September 9, 2024 12:33
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

Successfully merging this pull request may close these issues.

2 participants