You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Vite plugin for Vue I18n
9
9
## :star: Features
10
10
- i18n resources pre-compilation
11
11
- i18n custom block
12
+
- Bundling optimizations
12
13
13
14
## :cd: Installation
14
15
@@ -24,6 +25,10 @@ $ npm i --save-dev @intlify/vite-plugin-vue-i18n
24
25
$ yarn add -D @intlify/vite-plugin-vue-i18n
25
26
```
26
27
28
+
## :warning: Notice
29
+
30
+
When this plugin is installed, Vue I18n can only use the Composition API, and if you want to use the Legacy API, you need to set the `compositionOnly` option to `false`.
31
+
27
32
28
33
## :rocket: Usage
29
34
@@ -122,6 +127,14 @@ ja:
122
127
</i18n>
123
128
```
124
129
130
+
### Bundling optimizations
131
+
132
+
vite-plugin-vue-i18n allows you to specify options in the plugin option to support bundling size optimization provided by vue-i18n.
133
+
134
+
The same thing can be [configured](https://vue-i18n-next.intlify.dev/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags) with the `define` option, but the plugin option is more friendly. Especially if you are using typescript, you can use intelisense.
135
+
136
+
About details, See the below section
137
+
125
138
126
139
## :wrench: Options
127
140
@@ -141,6 +154,35 @@ ja:
141
154
142
155
Note `json` resources matches this option, it will be handled **before the internal json plugin of Vite, and will not be processed afterwards**, else the option doesn't match, the Vite side will handle.
143
156
157
+
### `runtimeOnly`
158
+
159
+
- **Type:** `boolean`
160
+
- **Default:** `true`
161
+
162
+
Whether or not to use Vue I18n **runtime-only**, set in the `vue-i18n` field of Vite `alias` option.
163
+
164
+
If `false` is specified, Vue I18n (vue-i18n) package.json `module` field will be used.
165
+
166
+
For more details, See [here](https://vue-i18n-next.intlify.dev/advanced/optimization.html#improve-performance-and-reduce-bundle-size-with-runtime-build-only)
167
+
168
+
### `compositionOnly`
169
+
170
+
- **Type:** `boolean`
171
+
- **Default:** `true`
172
+
173
+
Whether to make vue-i18n's API only composition API. **By default the legacy API is tree-shaken.**
174
+
175
+
For more details, See [here](https://vue-i18n-next.intlify.dev/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
176
+
177
+
### `fullInstall`
178
+
179
+
- **Type:** `boolean`
180
+
- **Default:** `true`
181
+
182
+
Whether to install the full set of APIs, components, etc. provided by Vue I18n. By default, all of them will be installed.
183
+
184
+
If `false` is specified, **buld-in components and directive will not be installed in vue and will be tree-shaken.**
0 commit comments