Skip to content

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

@sapphi-red

Description

@sapphi-red

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 vitejs/vite-plugin-vue#17.

If <template lang="html"> should work (#6929), I think <script setup lang="js"> should also work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions