Skip to content

Commit ad85cc2

Browse files
committed
update docs
1 parent 61c1db7 commit ad85cc2

File tree

7 files changed

+70
-21
lines changed

7 files changed

+70
-21
lines changed

docs/installation.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,38 @@ In the [dist/ directory of the npm package](https://cdn.jsdelivr.net/npm/vue-i18
8383
8484
### From CDN or without a Bundler
8585
86-
- **`vue-i18n.global(.prod).js`**:
86+
- **`vue-i18n(.runtime).global(.prod).js`**:
8787
- 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
8992
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production
9093
9194
:::tip NOTE
9295
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="...">`.
9396
:::
9497
95-
- **`vue-i18n.esm-browser(.prod).js`**:
98+
- **`vue-i18n(.runtime).esm-browser(.prod).js`**:
9699
- For usage via native ES modules imports (in browser via `<script type="module">`)
97100
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build
98101
99102
### With a Bundler
100103
101-
- **`vue-i18n.esm-bundler.js`**:
104+
- **`vue-i18n(.runtime).esm-bundler.js`**:
102105
- For use with bundlers like `webpack`, `rollup` and `parcel`
103106
- Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
104107
- Does not ship minified builds (to be done together with the rest of the code after bundling)
108+
- Imports dependencies (e.g. `@intlify/core`, `@intlify/message-compiler`)
109+
- 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`

packages/core-base/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"bugs": {
2424
"url": "https://github.com/intlify/vue-i18n-next/issues"
2525
},
26-
"files": ["index.js", "dist"],
26+
"files": [
27+
"index.js",
28+
"dist"
29+
],
2730
"main": "index.js",
2831
"module": "dist/core-base.esm-bundler.js",
2932
"unpkg": "dist/core-base.global.js",
@@ -40,7 +43,12 @@
4043
},
4144
"buildOptions": {
4245
"name": "IntlifyCoreBase",
43-
"formats": ["esm-bundler", "esm-browser", "cjs", "global"]
46+
"formats": [
47+
"esm-bundler",
48+
"esm-browser",
49+
"cjs",
50+
"global"
51+
]
4452
},
4553
"sideEffects": false
4654
}

packages/core/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"bugs": {
2424
"url": "https://github.com/intlify/vue-i18n-next/issues"
2525
},
26-
"files": ["index.js", "dist"],
26+
"files": [
27+
"index.js",
28+
"dist"
29+
],
2730
"main": "index.js",
2831
"module": "dist/core.runtime.esm-bundler.js",
2932
"unpkg": "dist/core.global.js",

packages/message-compiler/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"bugs": {
2424
"url": "https://github.com/intlify/vue-i18n-next/issues"
2525
},
26-
"files": ["index.js", "dist"],
26+
"files": [
27+
"index.js",
28+
"dist"
29+
],
2730
"main": "index.js",
2831
"module": "dist/message-compiler.esm-bundler.js",
2932
"unpkg": "dist/message-compiler.global.js",
@@ -39,7 +42,12 @@
3942
},
4043
"buildOptions": {
4144
"name": "IntlifyMessageCompiler",
42-
"formats": ["esm-bundler", "esm-browser", "cjs", "global"]
45+
"formats": [
46+
"esm-bundler",
47+
"esm-browser",
48+
"cjs",
49+
"global"
50+
]
4351
},
4452
"sideEffects": false
4553
}

packages/runtime/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"name": "@intlify/runtime",
33
"version": "9.0.0-beta.15",
44
"description": "@intlify/runtime",
5-
"keywords": ["i18n", "internationalization", "intlify", "runtime"],
5+
"keywords": [
6+
"i18n",
7+
"internationalization",
8+
"intlify",
9+
"runtime"
10+
],
611
"license": "MIT",
712
"author": {
813
"name": "kazuya kawaguchi",
@@ -17,7 +22,10 @@
1722
"bugs": {
1823
"url": "https://github.com/intlify/vue-i18n-next/issues"
1924
},
20-
"files": ["index.js", "dist"],
25+
"files": [
26+
"index.js",
27+
"dist"
28+
],
2129
"main": "index.js",
2230
"module": "dist/runtime.esm-bundler.js",
2331
"types": "dist/runtime.d.ts",
@@ -31,7 +39,10 @@
3139
},
3240
"buildOptions": {
3341
"name": "IntlifyRuntime",
34-
"formats": ["esm-bundler", "cjs"]
42+
"formats": [
43+
"esm-bundler",
44+
"cjs"
45+
]
3546
},
3647
"sideEffects": false
3748
}

packages/vue-i18n/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ Internationalization plugin for Vue.js
3636
- **`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)
3737
- **`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)
3838

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
4047

4148
The `esm-bundler` builds now exposes global feature flags that can be overwritten at compile time:
4249

@@ -52,13 +59,6 @@ The build will work without configuring these flags, however it is **strongly re
5259

5360
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.
5461

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`
61-
6262
## :copyright: License
6363

6464
[MIT](http://opensource.org/licenses/MIT)

packages/vue-i18n/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
"bugs": {
2525
"url": "https://github.com/intlify/vue-i18n-next/issues"
2626
},
27-
"files": ["index.js", "dist"],
27+
"files": [
28+
"index.js",
29+
"dist"
30+
],
2831
"main": "index.js",
2932
"module": "dist/vue-i18n.runtime.esm-bundler.js",
3033
"unpkg": "dist/vue-i18n.global.js",

0 commit comments

Comments
 (0)