question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt SSG results in runtime error on Safari

See original GitHub issue

Reproduction

https://codesandbox.io/s/formkit-nuxt-ssr-minimal-dnikdj

Describe the bug

The app won’t render and returns the following error in the dev tools of Safari: SyntaxError: Invalid regular expression: range out of order in character class

To reproduce, look at the reproduction link, then:

  • run yarn generate
  • run a static HTTP server from the files in .output/public (an easy way to do so is to execute cd .output/public and then python -m http.server 8000 if you have python installed, the website should be navigated from safari at http://localhost:8000).

Note that this bug does not appear when running through node (or when executing the dev or preview commands of the nuxt cli).

Environment


  • Operating System: Darwin (Mac OS)
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.4
  • Package Manager: yarn@1.22.15
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
justin-schroedercommented, Jun 29, 2022

Ok — I was finally able to track this down. The only way I could reproduce the bug was using your python server. The issue is that the python server is not setting the charset to utf-8 in the Content-Type header on the javascript file responses. So any UTF-8 characters in your JS files die. However serve and other servers do return the charset with the content type:

entry.mjs request in python “server” entry.mjs request using “serve”
image image

FormKit will continue to require UTF-8 support, but if you really need to get it working without UTF-8 you can remove the alpha, alpha_spaces and alpha_numeric validation rules from your build by using a custom FormKit configuration (not defaultConfig). Currently those are the only places in FormKit where UTF-8 characters are used. However, I cannot guarantee that other UTF-8 characters wont be introduced at some point in the future.

I’m going to close this, but I appreciate you bringing it up, its a new one to me.

0reactions
justin-schroedercommented, Aug 8, 2022

maybe you need a meta tag on your page for charset?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Side Rendering - Nuxt
Server-side rendering (SSR), is the ability of an application to contribute by displaying the web-page on the server instead of rendering it in...
Read more >
Hydration failed because the initial UI does not match ... - GitHub
I got this error too and i delete ".next" folder and run "npm run dev" and it ... in the browser it will...
Read more >
Safari Runtime Error - Apple Community
Everytime I go onto MySpace, the log in page comes up and I type in my password. When I click Log-In, Safari shows...
Read more >
react-hydration-error - Next.js
When css-in-js libraries are not set up for pre-rendering (SSR/SSG) it will often lead to a hydration mismatch. In general this means the...
Read more >
Vue meta not getting updates - Stack Overflow
Recently I've read an article that because vue-meta (Vue in general) loads based on JavaScript Social media crawlers will not cache them ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found