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
- For direct use via `<script src="...">` in the browser. Exposes the `VueI18n` global.
150
+
- Note that global builds are not [UMD](https://github.com/umdjs/umd) builds. They are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) and is only meant for direct use via `<script src="...">`.
151
+
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production.
152
+
153
+
-**`vue-i18n.esm-browser(.prod).js`**:
154
+
- For usage via native ES modules imports (in browser via `<script type="module">`.
155
+
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build.
156
+
157
+
### With a Bundler
158
+
159
+
-**`vue-i18n.esm-bundler.js`**:
160
+
- For use with bundlers like `webpack`, `rollup` and `parcel`.
161
+
- Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
162
+
- Does not ship minified builds (to be done together with the rest of the code after bundling)
163
+
164
+
#### Bundler Build Feature Flags
165
+
166
+
Starting with 9.0.0-beta.2, `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
167
+
168
+
-`__VUE_I18N_FULL_INSTALL__` (enable/disable, in addition to vue-i18n APIs, components and directives all fully support installation: `true`)
-`__INTLIFY_PROD_DEVTOOLS__` (enable/disable intlify-devtools and vue-devtools support in production, default: `false`)
171
+
172
+
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:
173
+
174
+
- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
175
+
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
176
+
- 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)
177
+
178
+
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.
Copy file name to clipboardExpand all lines: jest.config.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,9 @@ module.exports = {
68
68
__GLOBAL__: false,
69
69
__ESM_BUNDLER__: true,
70
70
__ESM_BROWSER__: false,
71
-
__NODE_JS__: true
71
+
__NODE_JS__: true,
72
+
__FEATURE_FULL_INSTALL__: true,
73
+
__FEATURE_LEGACY_API__: true
72
74
},
73
75
74
76
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
0 commit comments