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

Errors are reported when using vue3 template setup #6762

Closed
jerrywu001 opened this issue Jun 1, 2022 · 14 comments · Fixed by #7196
Closed

Errors are reported when using vue3 template setup #6762

jerrywu001 opened this issue Jun 1, 2022 · 14 comments · Fixed by #7196
Labels

Comments

@jerrywu001
Copy link

Bug report

Packages affected

  • [👉🏽 ] sandpack-react

Description of the problem

Errors are reported when using vue3 template setup

<Sandpack template="vue3"  />
<template>
  <main id="app">
    <h1>{{ helloWorld }}</h1>
  </main>
</template>
                             
<script setup>
const helloWorld = ref("Hello World");
</script>

image

@jerrywu001 jerrywu001 added the bug label Jun 1, 2022
@danilowoz
Copy link
Member

@DeMoorJasper, it seems that given the following template, which includes the tags template, script, and style. But if you try to remove the style tag, it breaks something.

Sandbox: https://codesandbox.io/s/sandpack-project-forked-x9zfmb?file=/src/App.vue

@jerrywu001
Copy link
Author

jerrywu001 commented Jun 7, 2022

There is another problem:
using setup on the script tag, the console reports an error. And no results are displayed in the preview area.

<template>
  <main id="app">
    <h1>{{ helloWorld }}</h1>
  </main>
</template>
                             
<script setup>
const helloWorld = ref("Hello World");
</script>

image

@uyarn
Copy link
Contributor

uyarn commented Jun 8, 2022

@danilowoz no I think the key problem is Vue new feature setup script, by which developer can use all composition API like ref、onMounted directly after adding the seup attribute for script tag without import anything.
probably environment should move form vue-cli to @vue/cli

@Theiaz
Copy link

Theiaz commented Jun 17, 2022

Had the same issue today. Blocker for me to use codesandbox more frequently.

@danilowoz danilowoz transferred this issue from codesandbox/sandpack Jun 22, 2022
@holazz
Copy link

holazz commented Jul 27, 2022

same issue.

@Yoduh
Copy link

Yoduh commented Aug 25, 2022

<script setup> seems impossible to use with codesandbox. I hope this gets more attention as its becoming a more and more popular way to write components with Vue 3

@dojo-coder
Copy link

same issue

1 similar comment
@xiangrikuil
Copy link

same issue

@LowLifeArcade
Copy link

I wonder why this is still not working

@zymbth
Copy link

zymbth commented Nov 25, 2022

Looking forward to the support of vue3 syntax sugar <script setup>. At present, I have to convert my code by setup()

@zymbth
Copy link

zymbth commented Nov 30, 2022 via email

@danilowoz
Copy link
Member

We just merged a fix that address:

  • Error on deleting a script or style tag;
  • Support for <script setup>;

Here's a sandbox: https://codesandbox.io/s/charming-turing-oe2n17?file=/src/App.vue

Could someone please confirm that it's working?

@jerrywu001
Copy link
Author

We just merged a fix that address:

  • Error on deleting a script or style tag;
  • Support for <script setup>;

Here's a sandbox: https://codesandbox.io/s/charming-turing-oe2n17?file=/src/App.vue

Could someone please confirm that it's working?

When will it be released?

@danilowoz
Copy link
Member

It should already be live on CodeSandbox and Sandpack@1.17.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants