<script>
IncludeVue
will be registered as a global variable.vue.js
with vue.min.js
. This is a smaller build optimized for speed instead of development experience.dist/
directory of the NPM package you will find many different builds of Vue.js. Here’s an overview of the difference between them:UMD | CommonJS | ES Module (for bundlers) | ES Module (for browsers) | |
---|---|---|---|---|
Full | vue.js | vue.common.js | vue.esm.js | vue.esm.browser.js |
Runtime-only | vue.runtime.js | vue.runtime.common.js | vue.runtime.esm.js | - |
Full (production) | vue.min.js | - | - | vue.esm.browser.min.js |
Runtime-only (production) | vue.runtime.min.js | - | - | - |
<script>
tag. The default file from jsDelivr CDN at https://cdn.jsdelivr.net/npm/[email protected] is the Runtime + Compiler UMD build (vue.js
).pkg.main
) is the Runtime only CommonJS build (vue.runtime.common.js
).pkg.module
) is the Runtime only ES Module build (vue.runtime.esm.js
).<script type='module'>
.template
option, or mounting to an element using its in-DOM HTML as the template), you will need the compiler and thus the full build:vue-loader
or vueify
, templates inside *.vue
files are pre-compiled into JavaScript at build time. You don’t really need the compiler in the final bundle, and can therefore use the runtime-only build.package.json
:package.json
:process.env.NODE_ENV
to determine the mode they should run in. You should use appropriate bundler configurations to replace these environment variables in order to control which mode Vue will run in. Replacing process.env.NODE_ENV
with string literals also allows minifiers like UglifyJS to completely drop the development-only code blocks, reducing final file size.mode
option:new Function()
for evaluating expressions. The full build depends on this feature to compile templates, so is unusable in these environments.render
functions which work perfectly in CSP environments./dist
folder are only checked-in during releases. To use Vue from the latest source code on GitHub, you will have to build it yourself!