-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DevReady for, and needs developer effortsReady for, and needs developer efforts[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to takenpm PackagesRelated to npm packagesRelated to npm packages
Description
We should seek to move away from referencing Node.js built-ins from modules, e.g. import { parse } from 'url';
, where 'url'
is a reference to a browser-compatible variant of the Node url
module.
Reasons include:
- These automated polyfills are slated for removal in future versions of Webpack (reference)
- There is redundancy with other module usage such as the use of
qs
in the@wordpress/url
package- Contributes to larger overall bundle sizes
- The polyfills are not implemented using ES Modules and thus require pulling in much more code than is actually used (example, see full list)
Instances:
import { parse } from 'url'; import { parse, resolve } from 'url';
(Questionable: Instances within @wordpress/e2e-tests
and @wordpress/e2e-test-utils
? These may be compiled with Webpack, despite not being intended for use in a browser)
With this, it should be considered to disable automatic polyfills from Webpack (reference).
Metadata
Metadata
Assignees
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DevReady for, and needs developer effortsReady for, and needs developer efforts[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to takenpm PackagesRelated to npm packagesRelated to npm packages