Repository navigation
Build: Introduce the common build folder to be used by all modules
#6584
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eda4a97
Build: Put all build files into build top folder
gziolo 1035e6c
Framework: Move a11y and dom-ready to their own modules
gziolo 696059a
Edit Post: Move domReady logic to client-assets
gziolo d17da49
Make phpcs happy by adding dot at the end of comment
gziolo d5c0f7a
Make Eslint happy by removing no longer used domReady import
gziolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
Why are we calling
default? Is this an ES2015 module issue ? This should be called on aswp.domReady( fn );. Seems like a bug.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 it's the issue with how Webpack is configured.
wp.domReadyis an object with the current setup: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 dug into this a bit, and it's trickier than it appears on the surface.
This is what Webpack's
output.libraryExportconfiguration is meant to support: Setting a specific property as the value assigned on the library target (window).However, we have mixed needs: For something like
wp.editororwp.i18n, we want named exports to be respected, and assigned as nested properties within. Fordom-readythough, the default export function should be assigned aswp.domReady.In my head, it's as though we want
libraryExport: 'default'when there are no other named exports, otherwise using the default_entry_return_.So far as implementation, we might need to get our hands dirty with a custom Webpack plugin to achieve this. It probably needs to extend (whether via classical inheritance or just dynamically instantiating during
apply, I'm uncertain) Webpack'sExportPropertyMainTemplatePlugin.js. Where I started having trouble was determining the exports of a module to decide what to assign aslibraryExport.Uh oh!
There was an error while loading. Please reload this page.
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.
Alternative: have separate
outputconfigurations for specific edge-case modules likedom-ready, where we can assignlibraryExport: 'default'. This too is not made very simple in an all-in-one Webpack configuration like we have.Alternative alternative: Don't allow
defaultexports on packages.Alternative alternative alternative: Use CommonJS
module.exportsinstead ofexport defaultfrom thepackagesimplementation.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.
Alternative Alternative Alternative, assign the globals manually in "enqueues" importing things from the regular built modules :)
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.
Moving task to #6748 for further discussion.