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

<script setup> must has attribute lang="js" ? #3

Closed
zhanglolo opened this issue Aug 21, 2021 · 0 comments
Closed

<script setup> must has attribute lang="js" ? #3

zhanglolo opened this issue Aug 21, 2021 · 0 comments

Comments

@zhanglolo
Copy link

I like this plugin, great idea!!!

Here are my doubts:

if script don't has attribute lang="js" then get an error

[plugin:vue2-script-setup-transform] Unsupported script language: undefined

add to fix it, is something miss in document or just a bug?

The point of the error code:

if (lang === 'ts')
  plugins.push('typescript')
else if (lang === 'jsx')
  plugins.push('jsx')
else if (lang === 'tsx')
  plugins.push('typescript', 'jsx')
else if (lang !== 'js')
  throw new SyntaxError(`Unsupported script language: ${lang}`)

source code:

<template>
  <div>
    <h1>{{ msg }}</h1>
  </div>
</template>

<script setup>
import { ref } from "@vue/composition-api";

const msg = ref("bar")
</script>

<style></style>
@antfu antfu closed this as completed in 6e01d77 Aug 21, 2021
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

1 participant