-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Change how required built-ins are polyfilled #8727
Comments
This is the current state of art:
|
@gziolo The problematic line is https://github.com/WordPress/gutenberg/blob/master/packages/babel-preset-default/index.js#L11. That includes polyfills that affect the global scope when a given module uses language features that require a polyfill on older browers. |
Here's an example of what Gutenberg outputs today. source:
transpiled:
My contention is that Gutenberg should not ship code that requires the core-js polyfill. |
@blowery, we have just published new packages to npm which have /cc @aduth @youknowriad @ntwb |
Okey, this is still the case. I see: import "core-js/modules/es6.array.find"; in https://unpkg.com/@wordpress/[email protected]/build-module/components/navigable-toolbar/index.js Code of this polyfill: |
Opened #9171 hoping that it will solve the issue. However I still see imports like: require("core-js/modules/es6.array.find"); |
The current npm packages that being built for Gutenberg polyfill usage of some browser features that are not available on older browsers. This polyfill is global and affects any client who uses the gutenberg npm packages. This is unexpected and can alter the runtime environment in surprising ways. Additonally, some client environments do not require these polyfills and would work without them. Bundling them increases the overall bundle size and slows down loading.
Instead, gutenberg's packages should take one of two approaches: use use babel's
transform-runtime
plugin to replace problematic built-in usage, or stop polyfilling altogether and declare that host environments must polyfill certain features for Gutenberg to work on downlevel browsers. The later is the direction being taken by react-dom and some other libraries that require full ES5 compliance.Original discussion: #8057 (comment)
The text was updated successfully, but these errors were encountered: