phaser-webpack-loader icon indicating copy to clipboard operation
phaser-webpack-loader copied to clipboard

.then() never fires

Open aceofpack opened this issue 8 years ago • 2 comments

Hello,

Thanks for the great package albeit not seeing the then() fire once complete:

    this.game.plugins.add(WebpackLoader, AssetManifest)
      .load()
      .then(() => {
        console.log('loaded assets...')
        this.game.state.start('Start');
      })
      .catch(err => {
        console.error(err);
      });

My AppManifest looks like this:

  sprites: [
    'buttons/btn_blank_small.png',
    'buttons/btn_blank_big.png',
    'buttons/btn_blank_square.png',

   ...
    
  ],
  fonts: [
    'gooddog.ttf',
    'gooddog.woff',
    'gooddog.woff2',
  ]
};

I added the below to the webpack.config.js:

      {
        test: /\.(eot|svg|ttf|woff|woff2)$/,
        loader: 'file-loader?name=assets/fonts/[name].[ext]?[hash]'
      },

It moves the files ok.. the font works and is referenced in the css ok. I don't know why the then() doesn't fire - seems the promise is never returned.

Any help much appreciated.

aceofpack avatar Oct 07 '17 12:10 aceofpack

I found the problem when I delved into the plugin a bit more - I wasn't able to see any console errors until I commented out the below:

load() {
    return Promise.all([
      this._loadAssets(),
     // this._loadFonts(),
    ]).then(this._addSprites.bind(this));
  }

I then started to get errors I could work with until I got this working 👍

aceofpack avatar Oct 07 '17 13:10 aceofpack

Was it an issue in the library that could be fixed? Not sure why your catch didn't receive the error, any ideas based on what you found?

goldfire avatar Nov 02 '17 22:11 goldfire