Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Documentation: Update documentation about build process changes #66428
Documentation: Update documentation about build process changes #66428
Changes from 4 commits
ba84233
4d91975
111085e
03fb0aa
34e5eb5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like this. Why should a package.json mention a built file. why
wpModule: true
is not enough? since we already havemodule
defined in the package.json ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one aspect needs to be documented. Using
wpScript
or/andwpScriptModuleExports
marks the package as production package for strict verification of compatibility with GPL license.module
isn't configured correctly at the moment. Eventually, we can explore migrating to"type": "module"
andexports
configuration but it's a separate effort.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand, we've been relying on module to output ESmodules forever, why is it not correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at https://github.com/WordPress/gutenberg/blob/trunk/packages/a11y/package.json for instance
That package has both "module" and "wpScriptModuleExports" and they point to different modules/APIs. So we're saying that this package ships "two different ESmodules" in one package. As an npm package consumer, I'm really confused what
import something from '@wordpress/a11y'
will yield to me. Which one of these is going to be used? Ultimately a package can ship multiple modules, that's ok but not two versions of the same module.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened a follow-up #66562.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a duplication of the
exports
field for regular npm packages. Do we really need to invent our own convention?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sirreal can provide a more exhaustive response. We were discussing using the official configuration for ES Modules:
type
set tomodule
exports
covering entry pointsIt'll eventually happen, but more work is necessary. For example, all import statements that contain file paths must contain the file extension, for example:
import './file.js';
. That isn't the case currently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that there is no
wp_script_module_is_enqueued
helper method. It isn't strictly necessary here, but it might be helpful for extenders in different scenarios.