-
Notifications
You must be signed in to change notification settings - Fork 4.7k
De-duplicate Webpack build, especially components/
#929
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
10 commits
Select commit
Hold shift + click to select a range
228442a
Build `components/` directory separately
nylen d151f3e
Fix the build
nylen ebb69e5
Enqueue wp.components script
nylen 463a2be
Consolidate entry points into one variable
nylen 63b2db4
Register all `wp.` libraries as Webpack externals
nylen e768d79
Restructure imports to top-level entry points only
nylen a47cf55
Fix duplicate imports
nylen 3ba82c4
Fix naming of `withFocusReturn` HoC
nylen 8cac43e
Fix the tests
nylen 81a4bf4
Fix `wp-components` stylesheet and dependencies on editor page
nylen 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export { default as Button } from './button'; | ||
| export { default as Dashicon } from './dashicon'; | ||
| export { default as FormToggle } from './form-toggle'; | ||
| export { default as IconButton } from './icon-button'; | ||
| export { default as Panel } from './panel'; | ||
| export { default as Placeholder } from './placeholder'; | ||
| export { default as Spinner } from './spinner'; | ||
| export { default as Toolbar } from './toolbar'; | ||
|
|
||
| export { default as withFocusReturn } from './higher-order/with-focus-return'; | ||
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,8 +178,6 @@ function gutenberg_register_scripts() { | |
| 'https://unpkg.com/[email protected]/' . $moment_script, | ||
| array( 'react' ) | ||
| ); | ||
|
|
||
| // Editor Scripts. | ||
| gutenberg_register_vendor_script( | ||
| 'tinymce-nightly', | ||
| 'https://fiddle.azurewebsites.net/tinymce/nightly/tinymce' . $suffix . '.js' | ||
|
|
@@ -189,6 +187,8 @@ function gutenberg_register_scripts() { | |
| 'https://fiddle.azurewebsites.net/tinymce/nightly/plugins/lists/plugin' . $suffix . '.js', | ||
| array( 'tinymce-nightly' ) | ||
| ); | ||
|
|
||
| // Editor Scripts. | ||
| wp_register_script( | ||
| 'wp-date', | ||
| plugins_url( 'date/build/index.js', __FILE__ ), | ||
|
|
@@ -233,14 +233,26 @@ function gutenberg_register_scripts() { | |
| array( 'react', 'react-dom', 'react-dom-server' ), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'element/build/index.js' ) | ||
| ); | ||
| wp_register_script( | ||
| 'wp-components', | ||
| plugins_url( 'components/build/index.js', __FILE__ ), | ||
| array( 'wp-element' ), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'components/build/index.js' ) | ||
| ); | ||
| wp_register_script( | ||
| 'wp-blocks', | ||
| plugins_url( 'blocks/build/index.js', __FILE__ ), | ||
| array( 'wp-element', 'tinymce-nightly', 'tinymce-nightly-lists' ), | ||
| array( 'wp-element', 'wp-components', 'tinymce-nightly', 'tinymce-nightly-lists' ), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'blocks/build/index.js' ) | ||
| ); | ||
|
|
||
| // Editor Styles. | ||
| wp_register_style( | ||
| 'wp-components', | ||
| plugins_url( 'components/build/style.css', __FILE__ ), | ||
| array(), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'components/build/style.css' ) | ||
| ); | ||
| wp_register_style( | ||
| 'wp-blocks', | ||
| plugins_url( 'blocks/build/style.css', __FILE__ ), | ||
|
|
@@ -473,7 +485,7 @@ function gutenberg_scripts_and_styles( $hook ) { | |
| wp_enqueue_script( | ||
| 'wp-editor', | ||
| plugins_url( 'editor/build/index.js', __FILE__ ), | ||
| array( 'wp-api', 'wp-date', 'wp-i18n', 'wp-blocks', 'wp-element' ), | ||
| array( 'wp-api', 'wp-date', 'wp-i18n', 'wp-blocks', 'wp-element', 'wp-components' ), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'editor/build/index.js' ), | ||
| true // enqueue in the footer. | ||
| ); | ||
|
|
@@ -530,7 +542,7 @@ function gutenberg_scripts_and_styles( $hook ) { | |
| wp_enqueue_style( | ||
| 'wp-editor', | ||
| plugins_url( 'editor/build/style.css', __FILE__ ), | ||
| array( 'wp-blocks' ), | ||
| array( 'wp-components', 'wp-blocks' ), | ||
| filemtime( plugin_dir_path( __FILE__ ) . 'editor/build/style.css' ) | ||
| ); | ||
| } | ||
|
|
||
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.
I don't think we should export this in the root module. I'm thinking we should create a
index.jsin the./higher-order/folder to be able to import those asimport { withFocusReturn } from 'components/higher-order';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.
Oh I just saw your comment #929 (comment)
I still think we should make a distinction between importing components and HoC.
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.
How do we make this work like
wp.components.somethingbehind the scenes?I think this could be solved separately, in any case.