-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whatwg/tc39/node.js JSON modules #9246
Comments
awesome! thanks @sokra ! |
@sokra some additional information regarding JSON module imports: the above mentioned [previous] proposal has been changed to: https://github.com/tc39/proposal-json-modules (currently stage 2), which was spun off from: https://github.com/tc39/proposal-import-assertions/ (stage 3) allowing only the default import for JSON modules still stands, although the import will use an additional import assertion. I believe importing JSON without the assertion would not be allowed. |
Current it's optional. We will support the |
Importing JSON without the assertion is explicitly allowed, and imo encouraged. |
…bpack#9246). Import font.json and extract css_prefix_text
Bug reportChange request(this is not exactly a bug), more a change in behavior request to align with other implementations.
the expected change would be to be consistent with (see below) whatwg/tc39/node.js and treat a json module import as a default import, and do not allow or support named exports.
basically throw a warning, same or similar to what v4 does with js modules not having a named export, e.g.
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".
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 Rollup issue:
rollup/rollup#2920
** Expected Behavior
this would be a great addition for v5, as it would be a breaking change. not sure about the feasibility of integrating the same in v4 since it's only a warning.
edit: added Rollup issue reference
The text was updated successfully, but these errors were encountered: