Mark Lundin

Results 104 comments of Mark Lundin

Yep this is not ideal, but unfortunately I don't think this is possible to catch at run-time without instantiating the class first. A solution is to prevent users using the...

Would it not make sense to just debounce the listener?

To clarify, it is actually exported but it's null until the app has been initialised. Updated comment to reflect this

It doesn't really change between ES5/ESM. In either situation `pc.app` is null until it isn't, so `pc.app.fire('someEvent')` works once `app` is available. It's more a question of whether it should...

> Perhaps we should only add them when building ES5 targets, but not when building ESM? We also don't include a polyfill for `Object.entries()` which is partially responsible for #6011....

For now though, you're probably right @mvaligursky, we can just add a conditional flag that omits from the ES6 build

[core-js](https://github.com/zloirock/core-js/tree/master) does this. However some initial tests show it's quite aggressive. For example including `new Float32Array()` [adds polyfills for all methods](https://babeljs.io/repl#?browsers=chrome%208&build=&builtIns=usage&corejs=3.21&spec=true&loose=true&code_lz=HYUw7gBAYgNg9gQwC4GYBMBBATlhBPACgEog&debug=false&forceAllTransforms=true&modules=false&shippedProposals=true&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=unambiguous&lineWrap=false&presets=env&prettier=false&targets=&version=7.23.10&externalPlugins=babel-plugin-syntax-dynamic-import%406.18.0%2C%40babel%2Fplugin-syntax-dynamic-import%407.8.3&assumptions=%7B%7D), even those methods are never called. I imagine this...

I think that's fine for now, we just exclude these in the ES6 build

Closing for now. As of https://github.com/playcanvas/engine/pull/6079 ESM build omits the polyfills.

Thanks for flagging this @LeXXik. So on export the paths in import statements are remapped relative to the root. This obviously won't work if the app is above the root....