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
Respectfully, I believe not supporting named exports with JSON modules was the wrong decision. Importing JSON modules with named exports is indeed more ergonomic and lends itself to tree shaking.
This was a useful feature in Webpack, but is in the process of being removed due to this proposal. See webpack/webpack#9246
They are not fully general: not all JSON documents are objects, and not all object property keys are JavaScript identifiers that can be bound as named imports.
Sure, but that doesn't mean it wouldn't be useful. I would prefer to have the feature available even if it has limitations.
It makes sense to think of a JSON document as conceptually whatwg/html#4315 (comment) rather than several things that happen to be side-by-side in a file.
I think it can also make sense to think of a JSON document in terms of different importable fields.
The text was updated successfully, but these errors were encountered:
Summary
Respectfully, I believe not supporting named exports with JSON modules was the wrong decision. Importing JSON modules with named exports is indeed more ergonomic and lends itself to tree shaking.
This was a useful feature in Webpack, but is in the process of being removed due to this proposal. See webpack/webpack#9246
Response to reasons given
From: https://github.com/tc39/proposal-json-modules#why-dont-json-modules-support-named-exports
Sure, but that doesn't mean it wouldn't be useful. I would prefer to have the feature available even if it has limitations.
I think it can also make sense to think of a JSON document in terms of different importable fields.
The text was updated successfully, but these errors were encountered: