You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
Kicking off this thread to discuss interop, specifically getting CommonJS (cjs) resources from inside of an ESModule(esm)
We currently have a transparent interop. .js is reserved for cjs and .mjs is reserved for esm. When you import, statically or dynamically, the file extension is used to determine the resource type.
There is a pull request to introduce modes which would change the behavior regarding file extensions depending on meta data in the package.json
There are two other proposals for how to get cjs resources that are non transparent, and would be necessary to if .js were to be aliased to esm
import.meta.require
import {require} from 'nodejs'
There has also been a suggestion of offering scoped variables in esm, similar to what we currently do with cjs.
Kicking off this thread to discuss interop, specifically getting CommonJS (cjs) resources from inside of an ESModule(esm)
We currently have a transparent interop.
.jsis reserved for cjs and.mjsis reserved for esm. When you import, statically or dynamically, the file extension is used to determine the resource type.There is a pull request to introduce modes which would change the behavior regarding file extensions depending on meta data in the package.json
There are two other proposals for how to get cjs resources that are non transparent, and would be necessary to if
.jswere to be aliased to esmThere has also been a suggestion of offering scoped variables in esm, similar to what we currently do with cjs.
What do people think?