nuxt / scripts

Plug-and-play script optimization for Nuxt applications. (Public Preview)
https://scripts.nuxt.com
MIT License
152 stars 14 forks source link

Unterminated regular expression error in 0.6.2 #136

Closed benfeather closed 3 days ago

benfeather commented 1 week ago

After upgrading @nuxt/scripts to 0.6.2 and updating my global scripts from an array to an object, I'm getting this error:

CleanShot 2024-07-08 at 10 03 12@2x

Not sure Why the error lists the "YouTube embed" component, but the the error only occurs if @nuxt/scripts is enabled.

I have tried removing the "YouTube embed" component and I'm still getting the error, so I believe it's an issue with the scripts package.

benfeather commented 1 week ago

That component is using the "useScriptTag" composable, not sure if that would cause the error, but it did the same thing when disabled, so not sure.

harlan-zw commented 1 week ago

@huang-julien seems like a bug with the AST parsing of vue code which includes useScript for the checkScripts feature.

I think maybe we should catch the exception thrown from the transforms and allow any issues to propagate through the rest of the rollup plugins. Ideally, we'd transform the code the same as Nuxt also.

harlan-zw commented 3 days ago

Thanks for reporting, should be fixed in 0.6.4.