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.
Please try the following, it should work. If it was previously exported as default, so it may not be finding it. To further understand see SO here...
import { Polyfill } from 'es6-promise-polyfill';
// should be changed to below code
import Polyfill from 'es6-promise-polyfill';
Bonus:
If you want to do it with web pack look here... use babel-polyfill
npm install --save "babel-polyfill"module.exports = {
entry: ['babel-polyfill', './app/js']
};