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
Copy file name to clipboardExpand all lines: docs/installation.md
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,22 +83,38 @@ In the [dist/ directory of the npm package](https://cdn.jsdelivr.net/npm/vue-i18
83
83
84
84
### From CDN or without a Bundler
85
85
86
-
- **`vue-i18n.global(.prod).js`**:
86
+
- **`vue-i18n(.runtime).global(.prod).js`**:
87
87
- For direct use via `<script src="...">` in the browser. Exposes the `VueI18n` global
88
-
- 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 are only meant for direct use via `<script src="...">`
88
+
- In-browser message format compilation:
89
+
- `vue-i18n.global.js` is the "full" build that includes both the compiler and the runtime so it supports compiling message formats on the fly
90
+
- `vue-i18n.runtime.global.js` contains only the runtime and requires message formats to be pre-compiled during a build step
91
+
- Inlines all Vue I18n core internal packages - i.e. it’s a single file with no dependencies on other files. This means you **must** import everything from this file and this file only to ensure you are getting the same instance of code
89
92
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production
90
93
91
94
:::tip NOTE
92
95
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 are only meant for direct use via `<script src="...">`.
93
96
:::
94
97
95
-
- **`vue-i18n.esm-browser(.prod).js`**:
98
+
- **`vue-i18n(.runtime).esm-browser(.prod).js`**:
96
99
- For usage via native ES modules imports (in browser via `<script type="module">`)
97
100
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build
98
101
99
102
### With a Bundler
100
103
101
-
- **`vue-i18n.esm-bundler.js`**:
104
+
- **`vue-i18n(.runtime).esm-bundler.js`**:
102
105
- For use with bundlers like `webpack`, `rollup` and `parcel`
103
106
- Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
104
107
- Does not ship minified builds (to be done together with the rest of the code after bundling)
- Imported dependencies are also `esm-bundler` builds and will in turn import their dependencies (e.g. `@intlify/message-compiler` imports `@intlify/shared`)
110
+
- This means you **can** install/import these deps individually without ending up with different instances of these dependencies, but you must make sure they all resolve to the same version
111
+
- In-browser locale messages compilation:
112
+
- **`vue-i18n.runtime.esm-bundler.js` (default)** is runtime only, and requires all locale messages 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 `*.json` files)
113
+
- **`vue-i18n.esm-bundler.js`**: includes the runtime compiler. Use this if you are using a bundler but still want locale messages compilation (e.g. templates via inline JavaScript strings)
114
+
115
+
### For Node.js (Server-Side)
116
+
117
+
- **`vue-i18n.cjs(.prod).js`**:
118
+
- For use in Node.js via `require()`
119
+
- If you bundle your app with webpack with `target:'node'` and properly externalize `vue-i18n`, this is the build that will be loaded
120
+
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`
Copy file name to clipboardExpand all lines: packages/vue-i18n/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,14 @@ Internationalization plugin for Vue.js
36
36
-**`vue-i18n.runtime.esm-bundler.js` (default)** is runtime only, and requires all locale messages 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 `*.json` files)
37
37
-**`vue-i18n.esm-bundler.js`**: includes the runtime compiler. Use this if you are using a bundler but still want locale messages compilation (e.g. templates via inline JavaScript strings)
38
38
39
-
#### Bundler Build Feature Flags
39
+
### For Node.js (Server-Side)
40
+
41
+
-**`vue-i18n.cjs(.prod).js`**:
42
+
- For use in Node.js via `require()`
43
+
- If you bundle your app with webpack with `target: 'node'` and properly externalize `vue-i18n`, this is the build that will be loaded
44
+
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`
45
+
46
+
## Bundler Build Feature Flags
40
47
41
48
The `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
42
49
@@ -52,13 +59,6 @@ The build will work without configuring these flags, however it is **strongly re
52
59
53
60
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.
54
61
55
-
### For Node.js (Server-Side)
56
-
57
-
-**`vue-i18n.cjs(.prod).js`**:
58
-
- For use in Node.js via `require()`
59
-
- If you bundle your app with webpack with `target: 'node'` and properly externalize `vue-i18n`, this is the build that will be loaded
60
-
- The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`
0 commit comments