Skip to content

'import()' expressions are not supported yet on Node engine >=14.5.0 #250

Open
eslint-community/eslint-plugin-n
#13
@Tzahile

Description

@Tzahile

Hello,
I'm using Node 14 and all of my project is managed as a module ("type": "module" in package.json).
Until now, using everywhere imports and exports, I didn't see this error.

Lately I added a dynamic import to some new code like the following:

if(process.env.USE_NEW_CODE) {
  const { RunNewCode } = await import("./controllers/new/code.js");
  RunNewCode();
}

Suddenly I got 'import()' expressions are not supported yet error.

I have ecmaVersion field set to 2021,
and "engines": { "node": ">=14.5.0" }
According to the README of this rule, it should be enough

Node 14 fully supports ESM

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions