Skip to content

Commit 7ae07f7

Browse files
committed
docs: details on esm-bundler feature flags [ci skip]
1 parent 2d04ee6 commit 7ae07f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/vue/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@
3131
- **`vue.runtime.esm-bundler.js` (default)** is runtime only, and requires all templates to be pre-compiled. This is the default entry for bundlers (via `module` field in `package.json`) because when using a bundler templates are typically pre-compiled (e.g. in `*.vue` files).
3232
- **`vue.esm-bundler.js`**: includes the runtime compiler. Use this if you are using a bundler but still want runtime template compilation (e.g. in-DOM templates or templates via inline JavaScript strings). You will need to configure your bundler to alias `vue` to this file.
3333

34+
#### Bundler Build Feature Flags
35+
36+
Starting with 3.0.0-rc.3, `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
37+
38+
- `__VUE_OPTIONS_API__` (enable/disable Options API support, default: `true`)
39+
- `__VUE_PROD_DEVTOOLS__` (enable/disable devtools support in production, default: `false`)
40+
41+
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:
42+
43+
- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
44+
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
45+
- 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)
46+
3447
### For Server-Side Rendering
3548

3649
- **`vue.cjs(.prod).js`**:

0 commit comments

Comments
 (0)