-
Notifications
You must be signed in to change notification settings - Fork 147
esm loads mjs file extensions by default #575
Comments
Hi @dnalborczyk! In this case what you're seeing isn't related to In your example The type and reference check issues should be filed on
By default |
ah, ok! thanks a bunch for the rundown! I'll get back to the |
Yes. Their use of
Since it's by design you likely need to address the root issue. This is where dual packages fall apart. Since they have 2 entry points that execute 2 different code paths they get 2 different instances of their modules (makes those type and reference checks fail). In order for them to solve this they'd need to write the shared parts in CJS so it's a single instance. |
I think they should remove the .mjs files, or rely on the "modules" field for the time being, since that 'mjs' stuff is also still in flux.
just hit the root issue again. I'll come up with some use case for them.
that makes me think where speaking of which, are you still planning on releasing Though I think there's still some things to be ironed out regarding |
Yes. You can point to a non-me Module WG comment too.
I think someone may have already opened an issue on it for them. So you can pile on that one.
Since issues like this will become more of a thing. I might want to add a
Yep. It's the only way Lodash v5 will ship.
Ya probably. At the moment if a non- |
cool, thanks a lot! |
Pinging back to link to an opened |
ah, nice, thanks @jdalton !! |
I'm running
npm ci && find . -name '*.mjs' -delete
for quite a long time, and forgot to file an issue. esm is loading mjs file extensions by default. I assume this is not intended?this is not a problem per se, the problem arises when other 3rd party modules depending on 'graphql' make e.g. a type or reference check.
hypothetically, I don't recall the exact issue:
graphql[.js+mjs]
exports a type, e.g.GraphQLScalarType
graphql-tools
, which depends ongraphql
, but loads thecjs|js
version, and some functionality checks if the constructor is of type:GraphQLScalarType
consumer app
, depends ongraphql
andgraphql-tools
, is using theGraphQLScalarType
(from, as it stands, themjs package
), andgraphql-tools
fails to check for the constructor (because it got it from thecjs
package)repro:
although the graphql package has a module field
"module": "index.mjs"
if one would remove it it's still loading themjs
files.@jdalton on a different (related) note: is
esm
always looking into package.json module fields, or only if explicitly specified in themainFields
option?The text was updated successfully, but these errors were encountered: