Subscribe on changes!

`<script setup lang="js">` compiles to a different result with `<script setup>`

avatar
Dec 21st 2022

Vue version

3.2.45

Link to minimal reproduction

https://stackblitz.com/edit/node-iqu5zb?file=index.js

Steps to reproduce

  1. Open stackblitz
  2. npm i (automatically runs)
  3. npm start (automatically runs)

What is expected?

export default {
  setup(__props, { expose }) {
  expose();

const foo = 'foo';

const __returned__ = { foo }
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })
return __returned__
}

}

is output. (This output is the result without lang="js")

What is actually happening?

const foo = 'foo';

is output.

System Info

No response

Any additional comments?

I found this while digging around https://github.com/vitejs/vite-plugin-vue/issues/17.

If <template lang="html"> should work (https://github.com/vuejs/core/discussions/6929), I think <script setup lang="js"> should also work.