-
-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
Description
Related plugins
Describe the bug
Base on implementation here : https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/src/index.ts#L224
And the following state :
features.optionsAPI
is set tofalse
- No
define
set in config
It results in this expression
(false || undefined) ?? true
And unfortunately, the whole expression results to true
.
Indeed (false || undefined) === undefined
, and then comes the nullish coalescing operator.
I think what we want would be :
options.value.features?.optionsAPI ?? config.define?.__VUE_OPTIONS_API__ ?? true
I guess it's not a problem for __VUE_PROD_DEVTOOLS_
& __VUE_PROD_HYDRATION_MISMATCH_DETAILS__
because they fallback to false
.
Reproduction
https://stackblitz.com/edit/vitejs-vite-y1sguk
Steps to reproduce
- Notice no bundle size difference when toggling
features.optionsAPI
and runnpm run build
- Notice difference only when defining
define.__VUE_OPTIONS_API__
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
Memory: 6.32 GB / 15.49 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.0/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
bun: 1.1.26 - ~/.bun/bin/bun
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.