Uh oh!
There was an error while loading. Please reload this page.
esm: empty ext from pkg type/main doesnt affect format - #31021
Conversation
This ensures files with unknown extensions like foo.bar are not loaded as CJS/ESM when imported as a main entry point and makes sure that those files would maintain the same format even if loaded after the main entrypoint.
bmeck
commented
Dec 18, 2019
CC: @nodejs/modules-active-members |
guybedford
left a comment
There was a problem hiding this comment.
One of the major features of the ES module resolver is being able to support new file extensions in future, which is reliant on the fact that we always throw for unknown file extensions.
Giving special treatment to isMain was how we did this while ensuring compatibility with existing bins.
Happy to flesh this out further, but I don't think we should lose that extension property for the ESM resolver.
Uh oh!
There was an error while loading. Please reload this page.
bmeck
commented
Dec 19, 2019
It seems like there might be something more that needs to be done for |
nodejs-github-bot
commented
Dec 24, 2019
guybedford
commented
Dec 29, 2019
We are likely still missing the proper work on how Web Assembly integrates into the module system. There might be Web Assembly headers in future that specify the top-level resolution (like package.json). There is also some work to allow Web Assembly start functions to themselves run instantiation (removing the need for JS to be primary entry). Node.js should definitely track whatever happens here as it stabilizes. |
nodejs-github-bot
commented
Dec 29, 2019
This ensures files with unknown extensions like foo.bar are not loaded as CJS/ESM when imported as a main entry point and makes sure that those files would maintain the same format even if loaded after the main entrypoint. PR-URL: #31021 Reviewed-By: Guy Bedford <guybedford@gmail.com>
bmeck
commented
Dec 31, 2019
Landed in baa3621 |
This ensures files with unknown extensions like foo.bar are not loaded as CJS/ESM when imported as a main entry point and makes sure that those files would maintain the same format even if loaded after the main entrypoint. PR-URL: #31021 Reviewed-By: Guy Bedford <guybedford@gmail.com>
This ensures files with unknown extensions like foo.bar are not loaded as CJS/ESM when imported as a main entry point and makes sure that those files would maintain the same format even if loaded after the main entrypoint. PR-URL: #31021 Reviewed-By: Guy Bedford <guybedford@gmail.com>
This ensures files with unknown extensions like foo.bar are not loaded as CJS/ESM when imported as a main entry point and makes sure that those files would maintain the same format even if loaded after the main entrypoint. PR-URL: #31021 Reviewed-By: Guy Bedford <guybedford@gmail.com>
BREAKING (kind of a bugfix? unclear)
This ensures files with unknown extensions like
extension.unknownare notloaded as CJS/ESM when imported as a main entry point and makes
sure that those files would maintain the same format even if loaded
after the main entrypoint.
Added tests for importing missing extension and unknown extension after entrypoint along the way.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes