Summary
Elide doesn't support nested conditional exports in package.json, which prevents many popular npm packages from loading.
Reproduction
// test.ts
import { Collection } from '@discordjs/collection';
console.log(Collection);
npm install @discordjs/collection
elide run test.ts
# Error: Unsupported package exports: ''
Package.json exports that fail
{
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
Package.json exports that work
{
"exports": {
".": {
"types": "./lib/main.d.ts",
"require": "./lib/main.js",
"default": "./lib/main.js"
}
}
}
Expected behavior
Elide should resolve nested conditional exports per the Node.js package exports spec.
For ESM imports, it should resolve:
- Check
exports["."]
- Check
exports["."].import (since we're using ESM)
- Use
exports["."].import.default
Affected packages
Many packages in the discord.js ecosystem use this pattern:
@discordjs/collection
@discordjs/rest
@discordjs/ws
@discordjs/builders
discord.js itself
Workaround
Currently using esbuild to bundle dependencies, which resolves the exports correctly before Elide sees them.
Summary
Elide doesn't support nested conditional exports in package.json, which prevents many popular npm packages from loading.
Reproduction
npm install @discordjs/collection elide run test.ts # Error: Unsupported package exports: ''Package.json exports that fail
{ "exports": { ".": { "import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" }, "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" } } } }Package.json exports that work
{ "exports": { ".": { "types": "./lib/main.d.ts", "require": "./lib/main.js", "default": "./lib/main.js" } } }Expected behavior
Elide should resolve nested conditional exports per the Node.js package exports spec.
For ESM imports, it should resolve:
exports["."]exports["."].import(since we're using ESM)exports["."].import.defaultAffected packages
Many packages in the discord.js ecosystem use this pattern:
@discordjs/collection@discordjs/rest@discordjs/ws@discordjs/buildersdiscord.jsitselfWorkaround
Currently using esbuild to bundle dependencies, which resolves the exports correctly before Elide sees them.