Saturday, 21 August 2021

Solve web-dev-server pixi.js "import does not provide an export named 'default'" conflict

I'm trying to update an old site of mine that was using lit-element, pixi.js, and webpack to serve in dev and build. The new version of lit-element is lit and they recommend to use web-dev-server as mean to serve the code locally but when i'm trying to do so I get an error from pixi.js

https://lit.dev/docs/tools/development/ (for reference)

The requested module './../../../es6-promise-polyfill/promise.js' does not provide an export named 'Polyfill'

from what I found effectively the fill just provide an Immediately Invoked Function Expression while pixi.js is trying to do a module import

/*!
* @pixi/polyfill - v5.3.10
* Compiled Mon, 07 Jun 2021 22:37:25 UTC
*
* @pixi/polyfill is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/
import { Polyfill } from 'es6-promise-polyfill';
import objectAssign from 'object-assign';

// Support for IE 9 - 11 which does not include Promises
if (!window.Promise) {
  window.Promise = Polyfill;
}

I didn't have this issue with lit-element and webpack and I'm not sure on how to solve this properly. I guess it's a bundling issue but this is really not my strength here. Switching back to webpack seems to bring a whole lot other issues. (seems to be linked to this issue Relative references must start with either "/", "./", or "../" but since the solution in it is to use web-dev-server instead of webpack, I'm running in circle)

Any advice on this issue would be really appreciated, thanks in advance.



from Solve web-dev-server pixi.js "import does not provide an export named 'default'" conflict

No comments:

Post a Comment