]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: update dist file readme
authorEvan You <yyx990803@gmail.com>
Mon, 23 Mar 2020 19:26:16 +0000 (15:26 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 23 Mar 2020 19:26:16 +0000 (15:26 -0400)
packages/vue/README.md

index d82d9362cd3ad1ddd1b16a846b1d0a48f60a7535..f1870dfbe4e891cef0a84e5a5f9b8a263012338b 100644 (file)
@@ -2,11 +2,23 @@
 
 ## Which dist file to use?
 
-- **`vue.global(.prod).js`**:
+### From CDN or without a Bundler
+
+- **`vue(.runtime).global(.prod).js`**:
   - For direct use via `<script src="...">` in the browser. Exposes the `Vue` global.
-  - Note: global builds are not [UMD](https://github.com/umdjs/umd) builds. Instead they are built as [IIFEs](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
+  - Note: 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>`.
+  - **`vue.global.js`**: the "full" build that supports compiling templates on the fly.
+  - **`vue.runtime.global.js`**: runtime only, does not include runtime template compilation support. Use this if you are not using a bundler, but somehow pre-compiling your template.
+
+- **`vue.esm(.prod).js`**:
+  - For usage via native ES modules imports (in browser via `<script type="module">`, or via Node.js native ES modules support in the future)
+  - Inlines all dependencies - i.e. it's a single ES module with no imports from other files
+    - this means you **must** import everything from this file nad this file only to ensure you are getting the same instance of code.
+  - Hard-coded prod/dev branches, and the prod build is pre-minified (you will need to use different files for dev/prod)
 
-- **`*vue(.runtime).esm-bundler.js`**:
+### With a Bundler
+
+- **`vue(.runtime).esm-bundler.js`**:
   - For use with bundlers like `webpack`, `rollup` and `parcel`.
   - Leaves prod/dev branches with `process.env.NODE_ENV` guards (must be replaced by bundler)
   - Does not ship minified builds (to be done together with the rest of the code after bundling)
   - **`vue.runtime.esm-bundler.js`**: runtime only, does not include runtime template compilation support. **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 `*.vue` files).
   - **`vue.esm-bundler.js`**: includes the runtime compiler. Use this if you are using a bundler but still want runtime template compilation (e.g. in-DOM templates or templates via inline JavaScript strings).
 
-- **`vue.esm(.prod).js`**:
-  - For usage via native ES modules imports (in browser via `<script type="module">`, or via Node.js native ES modules support in the future)
-  - Inlines all dependencies - i.e. it's a single ES module with no imports from other files
-    - this means you **must** import everything from this file nad this file only to ensure you are getting the same instance of code.
-  - Hard-coded prod/dev branches, and the prod build is pre-minified (you will need to use different files for dev/prod)
+### For Server-Side Rendering
 
 - **`vue.cjs(.prod).js`**:
   - For use in Node.js server-side rendering via `require()`.
-  - The dev/prod files are pre-built, but are dynamically required based on `process.env.NODE_ENV` in `index.js`, which is the default entry when you do `require('vue')`.
+  - If you bundle your app with webpack with `target: 'node'` and properly externalize `vue`, this is the build that will be loaded.
+  - The dev/prod files are pre-built, but the appropriate file is automatically required based on `process.env.NODE_ENV`.