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
the expected change would be to be consistent with (see below) whatwg/tc39/node.js and treat the json import as a default import, and do not allow or support named exports .
couple reasons for not considering named exports: confusing and non-consistent behavior of "JSON Object" vs "JSON Array" (+ others, "string", null etc.). Also how to handle a "default" property on an "JSON Object".
if the separate json plugin is still a better option, it would be still great to adopt the consensus of not allowing named exports to have the same expectations working across browsers, engines and tools.
@lukastaegert what are your thoughts on this? I don't personally have an issue with JSON module support being external. But it seems everyone and their brother has integrated it into their core.
If it becomes an official feature, we could put it into core. But there will still be need for rollup-plugin-json as property tree-shaking is a useful feature that even Rollup itself relies upon. I would see this as a nice-to-have.
consider deprecating the rollup json plugin https://github.com/rollup/rollup-plugin-json and pull in core functionality into rollup main, with some changes in behavior.
the expected change would be to be consistent with (see below) whatwg/tc39/node.js and treat the json import as a default import, and do not allow or support named exports .
couple reasons for not considering named exports: confusing and non-consistent behavior of "JSON Object" vs "JSON Array" (+ others, "string", null etc.). Also how to handle a "default" property on an "JSON Object".
if the separate json plugin is still a better option, it would be still great to adopt the consensus of not allowing named exports to have the same expectations working across browsers, engines and tools.
additional background:
WHATWG
whatwg/html#4315
https://html.spec.whatwg.org/#json-module-script
https://html.spec.whatwg.org/#creating-a-json-module-script (give it some time to load)
TC39 https://docs.google.com/presentation/d/1w8jWjD41htD7VxOejFqiHi6uGgHVWtZ_XmgFxgKkS7Q/edit#slide=id.g5947c7781f_0_20
Node.js modules working group
nodejs/node#27752
related Webpack issue:
webpack/webpack#9246
Expected Behavior / Situation
Actual Behavior / Situation
Modification Proposal
edit: modified reasons section, added webpack issue reference
The text was updated successfully, but these errors were encountered: