-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Polyfills should be a build step only #6072
Comments
Perhaps we should only add them when building ES5 targets, but not when building ESM? |
We also don't include a polyfill for |
For now though, you're probably right @mvaligursky, we can just add a conditional flag that omits from the ES6 build |
Wouldn't it be easier to change the engine compile process to translate output ESM build to UMD and have that step add the polyfills? |
core-js does this. However some initial tests show it's quite aggressive. For example including Auto-polyfilling definitely seems like the right way to go, but it needs some more investigation and optimisation. Either way, as #6011 shows, we don't have a polyfill for |
Considering we're hoping to deprecate the IMD build in no too distant future, we might just add that single polyfill missing at the moment and call it a day for now. |
I think that's fine for now, we just exclude these in the ES6 build |
Closing for now. As of #6079 ESM build omits the polyfills. |
The engine currently ships with a load of polyfills which are automatically imported in a build whether you need them or not. Consequently building against a modern target like ES2020 inlines these polyfils when they're actually not required. In addition, if playcanvas is included in a project with it's own build step + polyfills, these would likely clash.
Ideally polyfills should be part of the build step and not the source code. Using core-js with babel-preset-env or similar, only the required polyfills are chosen based on the chosen output target
The text was updated successfully, but these errors were encountered: