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 error: TypeError: .../valibot/dist/index.js: symbol.charCodeAt is not a function #240

Closed
gcornut opened this issue Nov 3, 2023 · 3 comments
Assignees
Labels
external Problem has external origin question Further information is requested

Comments

@gcornut
Copy link
Contributor

gcornut commented Nov 3, 2023

Hi,

I'm encountering a new error when trying to bundle valibot in a production app with a webpack 5 + babel config:

TypeError: node_modules/valibot/dist/index.js: symbol.charCodeAt is not a function

I've managed to investigate the error, and found that it appeared in v0.20.0 (v0.19.0 works fine) and I found that it actually comes from the EMOJI_REGEX that does not compile correctly with my configuration (maybe babel ? maybe corejs?).
It looks like a fresh install of webpack + babel does not trigger this error.

So it's probably not something that valibot should fix, I'll investigate more to try to find the exact problem in my configuration (sorry I can't share my config here). If anyone has an idea I'm interested, otherwise, I'll try to find the solution and share it here :)

@fabian-hiller fabian-hiller self-assigned this Nov 3, 2023
@fabian-hiller fabian-hiller added question Further information is requested external Problem has external origin labels Nov 3, 2023
@fabian-hiller
Copy link
Owner

Thanks for the hint! Please let us know once you know how to fix it.

@gcornut
Copy link
Contributor Author

gcornut commented Nov 3, 2023

It looks like a very similar issue to mathiasbynens/regexpu-core#13

regexpu-core is a core library used in babel plugins (in dependencies of @babel/preset-env) that read & transform regexp (to polyfill RegExp features on older browser). The new EMOJI_REGEX in valibot v0.20.0 uses some RegExp features that are crashes in older version of regexpu-core.

I did a force update of all my babel dependencies (and their recursive dependencies) with yarn up -R '@babel/*' 'babel-*' and it seems to work.

So I guess we can close the issue.

@fabian-hiller
Copy link
Owner

Thank you for the tip! I can reopen this issue it if there are more Webpack issues related to this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Problem has external origin question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants