Skip to content

[Case Study] does load esm modules supported? #1237

@zdm

Description

@zdm

Hi.
Node 14 was release, esm warning was removed.
Does yarn supported load es modules?
I tried to add type = module to package json and got error.

internal/modules/cjs/loader.js:1201
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: d:\downloads\111\1.js
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1201:13)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.module_1.Module._load (d:\downloads\111\.pnp.cjs:10899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_REQUIRE_ESM'
}

I am doing something wrong or yarn just not supported this feature?

I am using yarn rc-32.

Metadata

Metadata

Assignees

Labels

case studyPackage compatibility report

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions