nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.96k stars 5.03k forks source link

The regex caused the auto-imports to fail. #28190

Closed Ice-Hazymoon closed 4 months ago

Ice-Hazymoon commented 4 months ago

Environment

Reproduction

https://stackblitz.com/edit/github-c1luxa?file=app.vue

Describe the bug

const regex =
  /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; //

Once I use this regex anywhere in the script tag, all subsequent auto-imports stop working.

Seriously, I often encounter this issue, especially when I write some content or comments within the template tags. Even though it fully complies with Vue's syntax, it causes compilation to fail until I either delete the content, change some words, or rewrite it differently. I don't understand the internal parsing logic of Nuxt or Vue3. This issue doesn't always happen, but it's quite common.

Additional context

No response

Logs

No response

stackblitz[bot] commented 4 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

danielroe commented 4 months ago

let's track in https://github.com/unjs/unimport/issues/346.