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
My understanding that the intention is for importSync() to behave exactly like import(), but synchronous. In turns, that should mean importSync()should behave exactly like a namespace import, i.e. import * as NS from "...";.
I found that this is not the case, at least when importing from commonjs packages:
ember new --yarn --embroider zomg
yarn add -D @embroider/macros
From the brief PR description, it seems like my understand is correct (that importSync should behave like imports) and it was added to fix this very bug, albeit perhaps with a different scenario in mind. It seems like it is trying to perform a similar function as the __webpack_require__.n shim, but as you can see the implementation is quite different and it causes a different and undesirable result, at least in this case.
In case qunit is special, I also tested on the "virtual-dom" NPM package as that's what I happen to have in the app, with similar results.
The text was updated successfully, but these errors were encountered:
functionesCompat(m){if(m?.__esModule){returnm;}else{return{default: m, ...m};}}
This is slightly different than the webpack result (importSync("foo") !== import * as Foo from "foo"), in that the webpack namespace import does not add the default key, but this is more to spec anyway.
If we want to really follow the spec, the object also should be sealed and have a null prototype, but the existing code already doesn't care about that it seems.
My understanding that the intention is for
importSync()
to behave exactly likeimport()
, but synchronous. In turns, that should meanimportSync()
should behave exactly like a namespace import, i.e.import * as NS from "...";
.I found that this is not the case, at least when importing from commonjs packages:
esCompat
is added in #1076From the brief PR description, it seems like my understand is correct (that
importSync
should behave like imports) and it was added to fix this very bug, albeit perhaps with a different scenario in mind. It seems like it is trying to perform a similar function as the__webpack_require__.n
shim, but as you can see the implementation is quite different and it causes a different and undesirable result, at least in this case.In case qunit is special, I also tested on the
"virtual-dom"
NPM package as that's what I happen to have in the app, with similar results.The text was updated successfully, but these errors were encountered: