Skip to content
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

Gradually externalize @wordpress/components and finally opt-in all imports via DEWP #1833

Closed
31 tasks done
eason9487 opened this issue Dec 30, 2022 · 0 comments · Fixed by #2056
Closed
31 tasks done
Assignees
Labels
type: enhancement The issue is a request for an enhancement. type: technical debt - dependency extraction This issue/PR suffers from the dependency extraction and management

Comments

@eason9487
Copy link
Member

eason9487 commented Dec 30, 2022

With the ability to selectively externalize specific imports, introduced in #1762, we can start gradually externalizing @wordpress/components, and finally opt-in all imports via DEWP.

This issue is used to track this process and illustrate the approach.

Progress of @wordpress/components imports to be externalized

  • __experimentalInputControl - #2054
  • Button - #1834
    • @import "node_modules/@wordpress/components/src/button/style"; in _gutenberg-components.scss should be removed together.
  • Card - #2036
  • CardBody - #2036
  • CardDivider - #2036
  • CardFooter - #2036
  • CardHeader - #2036
  • CheckboxControl - #2054
  • Dashicon - #2037
  • Dropdown - #2042
  • ExternalLink
  • Flex - #2036
  • FlexBlock - #2036
  • FlexItem - #2036
  • Icon - #2037
  • KeyboardShortcuts - #1914
  • Modal - #2042
  • NavigableMenu - #2042
  • Notice - #2037
  • Panel - #1881
    • @import "node_modules/@wordpress/components/src/panel/style"; in _gutenberg-components.scss should be removed
  • PanelBody - #1881
  • PanelRow - #1881
  • Popover
  • RadioControl - #2054
  • SelectControl - #2054
  • Tip - #2037
  • ToggleControl - #2054
  • Tooltip

Externalization steps

  1. Add 'extracted/' prefix to all '@wordpress/components' imports of the selected component(s).
    • For example, import { Modal } from '@wordpress/components'; should be changed to import { Modal } from 'extracted/@wordpress/components';.
    • Please note that components with dependencies should be externalized together, e.g. Flex, FlexBlock and FlexItem.
  2. Search if there are related JavaScript workarounds for compatibility reasons that can be removed as well.
  3. Search if there are related CSS styles for compatibility reasons that can be removed as well.
    • If these CSS styles still need to be preserved, check whether they can be scoped to the CSS class .gla-admin-page in _gutenberg-components.scss.
  4. Test the usages of the externalized components in GAL with WordPress versions covering at least L-2.
  5. Once a PR has been merged, please mark the related tracking item(s) as completed in this issue.

Opt-in all @wordpress/components imports via DEWP

Once all the externalizations are done, it should be time to opt-in @wordpress/components via DEWP and revert all related imports back to without the extracted/ prefix

  • Remove 'extracted/' prefix from all 'extracted/@wordpress/components' imports - #2055
  • Remove @import "node_modules/@wordpress/components/src/date-time/date/datepicker"; from _gutenberg-components.scss - #2055
  • Remove '@wordpress/components' from the requestToExternal array in the webpack config - #2055

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement The issue is a request for an enhancement. type: technical debt - dependency extraction This issue/PR suffers from the dependency extraction and management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant