Closed michaelfig closed 5 years ago
Shouldn't it be consistent?
Hi @michaelfig!
The esm
loader doesn't apply any options to .mjs
files. From the readme:
🔒
.mjs
files are limited to basic functionality without support foresm
options.
This is because .mjs
files align with the experimental support of Node (pre-Node v12 at the moment). If you stick with .js
you'll be fine though as Node will eventually ship a mechanism to use .js
files too.
Thanks, .js
works like a charm!
First off, thanks so much for
esm
!I'm running into a problem when using it with
*.mjs
files. Here is a minimal test case:I would have expected that
@michaelfig/slog
could be imported successfully both int.js
andt.mjs
. A clue is found in the@michaelfig/slog/package.json
:So, when the file is named
*.mjs
, it uses the"main"
entry instead of the"module"
entry. Shouldn't it be consistent?Note that I haven't specified any
esm
options, just the defaults.Any help you can offer would be most appreciated, Michael.