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

Webpack: Unexpected token #51

Open
Matix-Media opened this issue Aug 19, 2021 · 9 comments
Open

Webpack: Unexpected token #51

Matix-Media opened this issue Aug 19, 2021 · 9 comments

Comments

@Matix-Media
Copy link

Matix-Media commented Aug 19, 2021

I dont know if this is my fault, but it seems like that there is some kind of typo or some sort because webpack cant seem to parse this module.

The error:

 error  in ./node_modules/prismarine-nbt/nbt.js

Module parse failed: Unexpected token (165:26)
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
|   int (value) { return { type: 'int', value } },
|   list (...value) {
>     const type = value[0]?.type ?? 'end'
|     return { type: 'list', value: { type, value } }
|   }

Is this line supposed to mean something like this: value[0].type ? value[0].type : 'end'?

@rom1504
Copy link
Member

rom1504 commented Aug 20, 2021

try with a newer node

@Matix-Media
Copy link
Author

I have node 15 installed

@uxes
Copy link

uxes commented Sep 11, 2021

try higher, like v16.8.0

@Matix-Media
Copy link
Author

Matix-Media commented Sep 15, 2021

It seems like that this library is written in es@next, meaning the that it has features that are in the pipeline but not officially released, so webpack does not know how to deal with them. Do you know what I should do?

Edit: I already tried setting the target in the tsconfig to "ESNext".

@extremeheat
Copy link
Member

Update your dependencies

@extremeheat
Copy link
Member

extremeheat commented Sep 15, 2021

node/npm makes it very easy to clean install everything if you have versioning or dependency issues since all the relevant data is in your local folder.

Run npm uninstall all your dependencies (npm uninstall *) delete the package lock, node_modules, update to node 16 then install the packages again one by one.

@Matix-Media
Copy link
Author

I have updated my dependencies. The problem is, that I use vue cli 3 for my project which still uses webpack 4 and not 5...

@extremeheat
Copy link
Member

You need to open an issue there then

@Matix-Media
Copy link
Author

So I assume this issue gets resolved if I use a newer version of webpack.

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

4 participants