-
-
Notifications
You must be signed in to change notification settings - Fork 6
module and main entry points are not exporting the same API #161
Comments
Strange... it's |
Those are the configs for Rollup.. https://github.com/tunnckoCoreLabs/hela-config-tunnckocore/tree/v0.5.19/config It creates ... Minute later: I think I got what's the problem.
|
In anyway... i will release #138 in day or two, for sure. So everything will be simplified in terms of usage and dev workflow / building. |
Can you give me what's the difference between them? What's exported by both? |
It means that you can't use |
For what it's worth, here is how I export my modules to provide the same API for both: index.cjs.js: class Foo {
}
exports.Foo= Foo; index.es.js: export class Foo {
} Then, using either |
Consistency is good thing, yea. But it's totally normal to expect require-ing esm to return an object with default key property. That's why it's in the module field. Because bundlers will load the module field instead, and so the behaving is the same. example.js import parse from 'parse-function'
console.log(parse) is the function if you use bundlers or running it with
|
Next version should fix this once and forever. |
See those two issues:
https://github.com/ericmorand/twing/issues/284
webpack/webpack#8171
To summarize, in the current state,
dist/index.es.js
anddist/index.js
are not exporting the same API. It means that what works when using parse-function in a node env is not guaranteed to work when using parse-function in the browser after parse-function has been bundled by WebPack or Rollup.The text was updated successfully, but these errors were encountered: