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

bundler-transformer error with array syntax for globals #121

Closed
vejja opened this issue Jul 1, 2024 · 3 comments
Closed

bundler-transformer error with array syntax for globals #121

vejja opened this issue Jul 1, 2024 · 3 comments

Comments

@vejja
Copy link
Collaborator

vejja commented Jul 1, 2024

I'm trying to load CF Turnstile with the following configuration :

export default defineNuxtConfig({
  scripts: {
      globals: [
        [ 
          { 
            src: 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit'
          }, 
          {
            use: () => {
              //@ts-expect-error
              return window.turnstile
            }
          }
        ]
      ]
    }
})

I'm getting the following error:

Capture d’écran 2024-07-02 à 00 46 25

Looks like an extra closing bracket is being inserted at the end of the useScript function in the virtual plugin ?

@vejja
Copy link
Collaborator Author

vejja commented Jul 3, 2024

Probably similar to #115

Tentatively blaming

})`

harlan-zw added a commit that referenced this issue Jul 3, 2024
@harlan-zw
Copy link
Collaborator

Thanks for the report, this is indeed a duplicate of #115.

However, I will note that we can only support serializable data within the nuxt config. So anything using functions isn't supported, I've included type improvements around this.

I'm putting some more thought into the API around the globals so may look a bit different soon.

@vejja
Copy link
Collaborator Author

vejja commented Jul 3, 2024

Ok understood
Let’s close then?

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