使用 vite 开发 vue3 时, 使用 import.meta.env.SSR 判断 ssr 逻辑代码,代码没有进行摇树优化,这是为啥? #10248
Answered
by
so1ve
J-env
asked this question in
Help/Questions
-
<script setup lang="ts">
const isSsr = import.meta.env.SSR;
const test = isSsr ? 'ssr' : 'client';
</script>
<template>
<div>{{ test }}</div>
</template> 打包后 代码依然存在 |
Beta Was this translation helpful? Give feedback.
Answered by
so1ve
Feb 22, 2024
Replies: 3 comments 5 replies
-
|
Beta Was this translation helpful? Give feedback.
2 replies
-
<ClientOnly>
...
</ClientOnly> |
Beta Was this translation helpful? Give feedback.
2 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
因为他把import.meta.env.SSR赋值给了变量