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

Error when import then build #1669

Closed
dohoangtung opened this issue Jun 22, 2024 · 2 comments
Closed

Error when import then build #1669

dohoangtung opened this issue Jun 22, 2024 · 2 comments

Comments

@dohoangtung
Copy link

dohoangtung commented Jun 22, 2024

Plugin version

From v21.x.x => v23.1.0

Steps to reproduce

  1. import intlTelInput from "intl-tel-input";
  2. yarn build

Got the error:

ERROR in ./node_modules/intl-tel-input/build/js/intlTelInput.js 1513:6
Module parse failed: Unexpected token (1513:6)
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
| var Iti = class {
| //* Can't be private as it's called from intlTelInput convenience wrapper.

id;

| //* NOT Private
| promise;
@ ./src/form-elements/TelInput/index.js 4:0-42
@ ./src/form-elements/index.jsx
@ ./src/form.jsx
@ ./src/index.jsx

Downgrade to version v20.x.x or v19.x.x => Build OK

@jackocnr
Copy link
Owner

jackocnr commented Jun 22, 2024

What does yarn build do? Please give as much detail as possible - what your build system is, which version, include config files etc.

But from the error message, it appears to be struggling with the syntax on this line which uses class fields.

So I guess your build system is not setup for that syntax. The error message suggests you might need to use an appropriate loader to handle this syntax?

@dohoangtung
Copy link
Author

dohoangtung commented Jun 23, 2024

Hi,

thanks for quick response

My env:

Nodejs v18
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
...
"webpack": "^4.46.0",

Yarn build will execute webpack with babel

Update webpack to latest version fix the issue!

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

2 participants