phaser3-typescript icon indicating copy to clipboard operation
phaser3-typescript copied to clipboard

webpack phaser expose-loader config

Open Gazzell opened this issue 3 years ago • 3 comments

When I try to run the examples and webpack boiler plate I get this error:

❯ yarn run webpack-boilerplate
yarn run v1.22.15
$ cd src/boilerplates/webpack-boilerplate && yarn && yarn run dev
[1/4] Resolving packages...
success Already up-to-date.
$ webpack --mode development && webpack serve --mode development
[webpack-cli] Failed to load '/mnt/data/projects/tests/phaser3-typescript/src/boilerplates/webpack-boilerplate/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'Phaser'

I could solve it changing the expose-loader plugin config, requiring phaser lowercased:

{
        test: require.resolve('phaser'),
        loader: 'expose-loader',
        options: { exposes: { globalName: 'Phaser', override: true } }
}

All examples I tried worked all right from here excepting boilerplate which had to unpate the Phaser import to:

import 'phaser';

Also, I found out that webpack sourcemaps are not showing exactly ts code as it does the parcel ones, is this normal?

Gazzell avatar Oct 18 '21 08:10 Gazzell

Good point @Gazzell I've checked that @YongJieYongJie PR https://github.com/digitsensitive/phaser3-typescript/pull/212 solved the problem although still incomplete (I left a comment to help there) I hope @digitsensitive can fix it soon

davidcosama avatar May 08 '22 05:05 davidcosama

@Gazzell Thanks for reporting. Is this still a problem after updating all the dependencies? I was not able to reproduce your error.

digitsensitive avatar Jul 30 '22 20:07 digitsensitive

@digitsensitive https://github.com/digitsensitive/phaser3-typescript/pull/212 it's fix for me

slowdream avatar Sep 16 '22 21:09 slowdream

@slowdream Thanks. PR #212 is merged.

digitsensitive avatar Oct 16 '22 18:10 digitsensitive