digitsensitive/phaser3-typescript

webpack phaser expose-loader config

Gazzell opened this issue · 4 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?

Good point @Gazzell I've checked that @YongJieYongJie PR #212 solved the problem although still incomplete (I left a comment to help there) I hope @digitsensitive can fix it soon

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

@digitsensitive #212 it's fix for me

@slowdream Thanks. PR #212 is merged.