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

Unexpected token; when import phaser-navmesh #46

Open
wristork opened this issue Oct 9, 2021 · 8 comments
Open

Unexpected token; when import phaser-navmesh #46

wristork opened this issue Oct 9, 2021 · 8 comments

Comments

@wristork
Copy link

wristork commented Oct 9, 2021

Hi, I'm can't import package phaser-navmesh. I not cool expert, more information then error text from console I cannot offer.

ERROR in ./src/js/phaser-navmesh-plugin.js 1:16670
Module parse failed: Unexpected token (1:16670)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders ...FILE CODE...

Trying work with just navmesh, not for phaser, it work correcntly.

@mikewesthad
Copy link
Owner

Hi @wristork, can you share a link to a minimal project setup where this error occurs?

@wristork
Copy link
Author

I'm sorry to be late with the reply. Project: https://github.com/wristork/phaser-navmesh-test.

Just webpack template from here https://github.com/photonstorm/phaser3-project-template

@hendrikras
Copy link

@wristork the link does not work.

I am having similar issues and have reproduced the problem here:
https://github.com/hendrikras/phaser3-typescript-starter-kit

any help would be greatly appreciated.

@kirabook
Copy link

I'm also running into this issue and couldn't find any solutions. I'm not used to managing my project via npm, but I compared my packages to the examples and it doesn't appear I'm missing any dependencies or anything. I haven't actually included any code yet. I've also created a temporary repository for this, but I don't want to keep it up too long.

https://github.com/kirabook/temporary-1
navmesherror

(Also, though this is probably a different issue, I'm also running into an error when trying to use the non-npm version.)
typerror

@plepers
Copy link

plepers commented Jan 17, 2022

Hi,
The 3 libraries are built using TS "ESNext" output and the built files contain class properties declarations.
It looks like this relativly recent ES feature is not supported on some webpack/babel setups.
I tried to add @babel/plugin-proposal-class-properties to my project without success. I'm not sure node_modules's files are processed by babel in my case.
Anyway, i solved the issue by rebuilding the library from sources, replacing tsconfig's output by "ES2021".
Hope it helps

@TheChemist
Copy link

I'm having the problem @hendrikras mentioned as well.

@plepers Can you describe, how you built the libaries yourself?

@brodynelson
Copy link

Hi,

I am also having this issue with the latest version.

error - ./node_modules/phaser-navmesh/dist/phaser-navmesh-plugin.js 1:4581
Module parse failed: Unexpected token (1:4581)

I have tried installing a typescript and javascript project. Any help would be much appreciated.

Thanks,

BN

@hankyu1
Copy link

hankyu1 commented Oct 24, 2022

@brodynelson
This is what I did to build it locally:

  1. cone navmesh repo and npm install
  2. go to /packages and find the library you need to build. For me I want to use the phaser 3 package so it would be phaser-navmesh
  3. inside the folder, find tsconfig.json and changed the target to ES6
  4. go back to root and run npm run build:libs
  5. once its done, go back to the library folder and you should find a dist folder in it. You can now import whatever is in it into your phaser project

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

8 participants