# vue
## Which dist file to use?
### 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 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="...">`.
- In-browser template compilation:
- **`vue.global.js`** is the "full" build that includes both the compiler and the runtime so it supports compiling templates on the fly.
- **`vue.runtime.global.js`** contains only the runtime and requires templates to be pre-compiled during a build step.
- Inlines all Vue 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.
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `*.prod.js` files for production.
- **`vue(.runtime).esm-browser(.prod).js`**:
- For usage via native ES modules imports (in browser via `<script type="module">`.
- Shares the same runtime compilation, dependency inlining and hard-coded prod/dev behavior with the global build.
### 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)
- Imports dependencies (e.g. `@vue/runtime-core`, `@vue/runtime-compiler`)
- Imported dependencies are also `esm-bundler` builds and will in turn import their dependencies (e.g. `@vue/runtime-core` imports `@vue/reactivity`)
- 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.
- In-browser template compilation:
- **`vue.runtime.esm-bundler.js` (default)** is runtime only, and requires all templates 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 `*.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). You will need to configure your bundler to alias `vue` to this file.
### For Server-Side Rendering
- **`vue.cjs(.prod).js`**:
- For use in Node.js server-side rendering via `require()`.
- 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`.
a3737337
- 粉丝: 0
- 资源: 2869
最新资源
- 顺丰API查询快递单基于顺丰丰桥SDK开发的用易语言源码 免开发调用 需要收寄人手机号码后四位+单号查询 简单对接接口,快速开发必备 .zip
- 随着前端技术越来越成熟,JS,TS已成为各大厂开发的必备使用语言,本站从易到难深入理解JS,TS,同时提供TS做题功能,让你边学边实践,快速掌握.zip
- 通过中缀、后缀实现一个四则运算器,并设计求解界面,由于我喜欢前端嘛,用前端语言实现起来容易以及界面写起来很顺手 .zip
- 该项目是一个使用TypeScript实现的简易版Web系统框架,旨在提供一套搭建Web应用程序的基础设施 它具备以下主要特点和功能1. 虚拟文件系统2. 语言系统3. 常用接口集合.zip
- 网页编辑器,拖拽读取文件,保存文件,支持大部分编程语言文件编辑,简单易用,无需安装,这正是我想要的.zip
- 电力系统分析:基于VBA的分布式电源最佳接入点判定方法与程序实现
- MATLAB实现线性代数方程组直接解法算法解析与实践案例
- 基于MATLAB的线性代数方程组雅克比迭代解法研究与应用
- 基于MATLAB实现的线性代数方程组高斯消去法解析与应用
- MATLAB实现拉格朗日插值多项式的数值计算方法
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈