Skip to content
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

Uncaught Promise when using Assets package with Webpack #8500

Closed
zOadT opened this issue Jul 16, 2022 · 2 comments
Closed

Uncaught Promise when using Assets package with Webpack #8500

zOadT opened this issue Jul 16, 2022 · 2 comments

Comments

@zOadT
Copy link
Contributor

zOadT commented Jul 16, 2022

Hey, great work on 6.5, super excited about the new packages! I just ran into in issue with the Assets package:

Expected Behavior

Importing the Assets package should not result in uncaught promises

Current Behavior

When importing the Assets package in an Webpack project two errors occur in Promises. I haven't checked other bundlers yet.

Possible Solution

The stack trace shows that there is a NPE in addFormats:

TypeError: formats is undefined
    addFormats assets.js:621
    step assets.js:77
    verb assets.js:58
    __awaiter assets.js:51
    __awaiter assets.js:47
    addFormats assets.js:619
    handleByList core.js:257
    add core.js:203
    add core.js:195
    add core.js:194
    node_modules vendors-node_modules_pixi_assets_dist_esm_assets_js-node_modules_eventemitter3_index_js-node_-5bd7c5.bundle.js:9783

The cause is reading formats.unshift

Steps to Reproduce

{
  "name": "assetstest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "serve": "webpack serve --mode development --no-client-overlay"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@pixi/assets": "^6.5.0-rc",
    "webpack": "^5.73.0",
    "webpack-cli": "^4.10.0",
    "webpack-dev-server": "^4.9.3"
  }
}
// src/index.js
import { Assets } from "@pixi/assets"
// Thats it. The API of Assets is still functional though
<!-- public/index.html -->
<!DOCTYPE html>
<html>
    <head>
        <script src="./main.js"></script>
    </head>
    <body></body>
</html>

(The default webpack settings are sufficient, so no need to define a webpack config)

$ npm run serve

Environment

  • pixi.js version: 6.5.0-rc
  • Browser & Version: Firefox 102; Chrome 103
@bigtimebuddy
Copy link
Member

I believe this was fixed in 6.5.0-rc.2 here #8497, could you try with that version?

@zOadT
Copy link
Contributor Author

zOadT commented Jul 16, 2022

Oh yes! Sorry, haven't seen the new rc. Thank you very much!

@zOadT zOadT closed this as completed Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants