Skip to content

Commit

Permalink
chore: link to compile-time flag reference in docs [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 27, 2023
1 parent ef90a99 commit d5f14ce
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,23 @@

#### Bundler Build Feature Flags

Starting with 3.0.0-rc.3, `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
[Detailed Reference on vuejs.org](https://vuejs.org/api/compile-time-flags.html)

- `__VUE_OPTIONS_API__` (enable/disable Options API support, default: `true`)
- `__VUE_PROD_DEVTOOLS__` (enable/disable devtools support in production, default: `false`)
- `__VUE_PROD_HYDRATION_MISMATCH_DETAILS__` (enable/disable detailed warnings for hydration mismatches in production, default: `false`)
`esm-bundler` builds of Vue expose global feature flags that can be overwritten at compile time:

The build will work without configuring these flags, however it is **strongly recommended** to properly configure them in order to get proper tree-shaking in the final bundle. To configure these flags:
- `__VUE_OPTIONS_API__`
- Default: `true`
- Enable / disable Options API support

- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
- Vite: configured by default, but can be overwritten using the [`define` option](https://github.com/vitejs/vite/blob/a4133c073e640b17276b2de6e91a6857bdf382e1/src/node/config.ts#L72-L76)
- `__VUE_PROD_DEVTOOLS__`
- Default: `false`
- Enable / disable devtools support in production

Note: the replacement value **must be boolean literals** and cannot be strings, otherwise the bundler/minifier will not be able to properly evaluate the conditions.
- `__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`
- Default: `false`
- Enable / disable detailed warnings for hydration mismatches in production

The build will work without configuring these flags, however it is **strongly recommended** to properly configure them in order to get proper tree-shaking in the final bundle.

### For Server-Side Rendering

Expand Down

0 comments on commit d5f14ce

Please sign in to comment.