question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Vue 3's <script setup>

See original GitHub issue

The Vue 3 starter does not support the <script setup> block, and renders an error message:

Script missing

Example usage of <script setup>:

<script setup>
import { ref } from 'vue'

const msg = ref('Hello World!')
</script>

<template>
  <h1>{{ msg }}</h1>
  <input v-model="msg">
</template>

StackBlitz demo

For reference, here’s a working Vue SFC playground demo.

A workaround is to use a Node starter with Vite installed.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Theiazcommented, Jun 17, 2022

Any updates on this?

Bump. Had the same problem today. Blocker for me to use stackblitz more frequently.

Additionally the error message Script missing is not that meaningful.

1reaction
Bobakanooshcommented, Jan 12, 2022

StackBlitz seems to be the only online code sandbox that supports multiple .vue files (JSFiddle doesn’t allow .vue, CodePen supports .vue but only lets you create one file on the free plan, repl.it is kind of a mess to configure for a simple Vue project).

It would be awesome if it could support <script setup>, since that seems to be the future of Vue, and imo the most concise and elegant way to define components. I’ve been looking for a place to host vue code to demonstrate issues I’m asking about online (e.g. on StackOverflow).

https://sfc.vuejs.org/

This does work, however it’s pretty simplistic. Definitely meets the “post on stackoverflow” necessity, but not the “use as an online project” necessity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

<script setup> | Vue.js
<script setup> is a compile-time syntactic sugar for using Composition API inside Single-File Components (SFCs). It is the recommended syntax if you are ......
Read more >
The 101 guide to Script Setup in Vue 3 - VueDose
Don't you know about Script Setup yet? Check out this short article now and learn the nicest way to define a Vue component...
Read more >
Support persistent layouts in Vue 3's setup sugar #651 - GitHub
When using the setup sugar (RFC), we can't use persistent layouts, because there is no way to set a property ( layout in...
Read more >
Moving from Vue 2's Option API to Vue 3's Composition API
Quick introduction to help migrate from the Vue 2 options API to Vue 3's Composition ... For the purposes of this post, I'm...
Read more >
What's new in Vue 3 — a roundup. Vue 3 - Medium
Why Vue 3? · Blazing fast, Vite-powered build toolchain · More ergonomic Composition API syntax via <script setup> · Improved TypeScript IDE support...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found