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
This is a CommonJS/ESM interop issue. Transpiler is expecting the file to be CJS but it is actually ESM and the wrapper is being before other files are loaded
Why would it expect it to be CJS when loading via node_modules (import { DateTime } from 'luxon';) but not when loading via the file path? (import { DateTime } from './luxon/src/luxon';)
EDIT: Doing import { DateTime } from './luxon'; also runs fine without errors (i assume that in this case, Bun is still reading the package.json so it knows to go into the src folder, etc.)
What version of Bun is running?
0.5.3
What platform is your computer?
Tested on
Linux 5.19.0-29-generic x86_64 x86_64
andMicrosoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
bun install luxon
test.mjs
:bun test.mjs
What is the expected behavior?
The expected behavior would be to have the import succeed and have the program exit immediately.
Running
node test.mjs
does this.What do you see instead?
Additional information
To troubleshoot, I tried doing an import from luxon's source code instead of from node_modules:
git clone https://github.com/moment/luxon.git
cd luxon
git checkout b1fee58b8719176ff55eb9709084102f6baeb77a
(this is the commit associated with their most recent release)bun test.mjs
and strangely, it works fine.
Maybe related to #453?
The text was updated successfully, but these errors were encountered: