Skip to content

Commit af4fc7b

Browse files
committed
docs: describe keepVueInstance config option
1 parent 6e29d3e commit af4fc7b

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

docs/config/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ See [the plugin's README](https://github.com/vuejs/vue-cli/blob/dev/packages/%40
227227

228228
Also, when SRI is enabled, preload resource hints are disabled due to a [bug in Chrome](https://bugs.chromium.org/p/chromium/issues/detail?id=677022) which causes the resources to be downloaded twice.
229229

230+
### keepVueInstance
231+
- Type: `boolean`
232+
- Default: `false`
233+
234+
Set to `true` to disable externalization of Vue instance when building as a library.
235+
230236
### configureWebpack
231237

232238
- Type: `Object | Function`

docs/guide/build-targets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ App is the default build target. In this mode:
1515

1616
::: tip Note on Vue Dependency
1717
In lib mode, Vue is *externalized*. This means the bundle will not bundle Vue even if your code imports Vue. If the lib is used via a bundler, it will attempt to load Vue as a dependency through the bundler; otherwise, it falls back to a global `Vue` variable.
18+
19+
You can avoid externalization of Vue by setting `keepVueInstance: true` in `vue.config.js`.
1820
:::
1921

2022
You can build a single entry as a library using

docs/ru/config/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ module.exports = {
217217

218218
Кроме того, когда включён SRI, подсказки preload ресурсов отключены из-за [ошибки в Chrome](https://bugs.chromium.org/p/chromium/issues/detail?id=677022), которая заставляет ресурсы загружаться дважды.
219219

220+
### keepVueInstance
221+
- Тип: `boolean`
222+
- По умолчанию: `false`
223+
224+
Установите в значение `true`, чтобы отключить экстернализицию Vue при сборке библиотеки.
225+
220226
### configureWebpack
221227

222228
- Тип: `Object | Function`

docs/ru/guide/build-targets.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
::: tip Примечание о зависимости Vue
2121
В режиме библиотеки Vue *экстернализируется*. Это означает, что сборка не будет содержать Vue, даже если ваш код его импортирует. Если библиотека используется через сборщик, он должен попытаться загрузить Vue в качестве зависимости через сборщик; в противном случае, он должен вернуться к глобальной переменной `Vue`.
22+
23+
Чтобы избежать экстернализиции Vue можно установить `keepVueInstance: true` в `vue.config.js`.
2224
:::
2325

2426
Вы можете запустить сборку одной точки входа в качестве библиотеки с помощью:

0 commit comments

Comments
 (0)