Skip to content

Exports in package.json don't work as expected in ESM #1

@darksabrefr

Description

@darksabrefr

Hello,

In an ESM and node context, this lib causes this warning. It's indirectly imported from traverse > typedarray.prototype.slice > typed-array-byte-offset > reflect.getprototypeof > which-builtin-type > is-async-function in our setup.

ExperimentalWarning: CommonJS module /project/node_modules/is-async-function/index.js is loading ES Module /project/node_modules/async-function/require.mjs using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
ExperimentalWarning: CommonJS module /project/node_modules/is-async-function/index.js is loading ES Module /project/node_modules/async-function/require.mjs using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
     at require (node:internal/modules/helpers:136:16)
     at Object.<anonymous> (/project/node_modules/is-async-function/index.js:13:20)
     at Module._compile (node:internal/modules/cjs/loader:1546:14)
     at Object..js (node:internal/modules/cjs/loader:1698:10)
     at Module.load (node:internal/modules/cjs/loader:1303:32)
     at Function._load (node:internal/modules/cjs/loader:1117:12)
     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
     at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
     at Module.require (node:internal/modules/cjs/loader:1325:12)
     at require (node:internal/modules/helpers:136:16)

The exports field of the package.json is weird too :

	"exports": {
		".": [
			{
				"module-sync": "./require.mjs",
				"import": "./index.mjs",
				"default": "./index.js"
			},
			"./index.js"
		],
		"./package.json": "./package.json"
	},

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