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

The const variable in **<script setup>** doesn't expose correct in **production** env when @nuxt/vite-builder 3.0.0-rc.3 upgrade to @nuxt/vite-builder 3.0.0-rc.6 #14363

Closed
aborn opened this issue Jul 22, 2022 · 1 comment

Comments

@aborn
Copy link

aborn commented Jul 22, 2022

Environment


  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.6
  • Package Manager: yarn@1.22.4
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Here is a demo page. It's works fine when runing this demo page in dev env. But it works different in production env.

<template>
  <div>
    <h1>Demo page</h1>
    <p>{{ vMsg }}</p>
    <button @click="onClickVMsg">MsgBtn</button>
  </div>
</template>

<script setup>
const vMsg = ref("hello msg")
</script>

<script>
export default {
  methods: {
    onClickVMsg() {
      console.log(this.vMsg)
      this.vMsg = 'currentTime==>' + new Date()
    }
  }
}
</script>

The production deploy as follows:

yarn build
node .output/server/index.mjs

Describe the bug

The <script setup> works different behavior between dev env and production env. The const variable in <script setup> doesn't expose correctly when nuxt upgrade from 3.0.0-rc.3 to 3.0.0-rc.6. I work around found out that the problem is @nuxt/vite-builder 3.0.0-rc.3 upgrade to @nuxt/vite-builder 3.0.0-rc.6 .

The demo page const variable vMsg doesn't expose correctly in production env (after yarn build).

Additional context

Demo source code project:
https://github.com/aborn/playgrounds/tree/main/nuxt-demo
or
https://stackblitz.com/edit/github-dfvwhg?file=pages/index.vue

Logs

No response

@danielroe
Copy link
Member

I think this is the behaviour you're reporting: vuejs/core#6242.

I think we can track there, but particularly note vuejs/core#6242 (comment).

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants