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 has been archived by the owner on Nov 4, 2024. It is now read-only.
I'm hoping to get some help here from the experts although it's technically not a std/esm issue. I am attempting move away from std/esm and use the "native" esm in V14.
The issue I am having is that unlike std/esm the native version is breaking the named imports (from I assume commonjs module exports) that worked fine with std/esm.
I have in my package the import import { sync as mkdir } from 'make-dir' which works fine in std/esm. But using native it says it can't find the named export sync.
Am I stuck here? Do I need to stay with std/esm? (but it looks like the project is over now) I can't/shouldn't go through my entire code base accommodating cjs modules with
import mk from 'make-dir'
const mkdir = mk.sync
Also if I add to any package.json "type":"module" and run with std/esm it throws errors so it looks like I can't mix these.
Anyway was under the assumption that the native was going to be a drop in replacement for using std/esm. Apparently not :(.
That was kinda of the danger of using esm before the commonjs interop was officially defined by node. And unfortunately until packages update to have real named exports, you will have to update your imports like you've done above.
I'm hoping to get some help here from the experts although it's technically not a std/esm issue. I am attempting move away from std/esm and use the "native" esm in V14.
The issue I am having is that unlike std/esm the native version is breaking the named imports (from I assume commonjs module exports) that worked fine with std/esm.
Take for example https://github.com/sindresorhus/make-dir/blob/978bee9186bf0c41640ed21567921daf8c303225/index.js#L106
I have in my package the import
import { sync as mkdir } from 'make-dir'
which works fine in std/esm. But using native it says it can't find the named exportsync
.Am I stuck here? Do I need to stay with std/esm? (but it looks like the project is over now) I can't/shouldn't go through my entire code base accommodating cjs modules with
Also if I add to any package.json
"type":"module"
and run with std/esm it throws errors so it looks like I can't mix these.Anyway was under the assumption that the native was going to be a drop in replacement for using std/esm. Apparently not :(.
I made a stack overflow post of this. Maybe best to reply there?
https://stackoverflow.com/questions/62088912/std-esm-vs-native-esm-in-node-v14-cant-find-named-import-from-cjs-modules
The text was updated successfully, but these errors were encountered: