Skip to content

Commit 5f66924

Browse files
Migration introduction improvement (#186)
* feat: added removed and breaking features * fix: removed outdated info from installation * fix: added custom components interop
1 parent d050704 commit 5f66924

File tree

2 files changed

+25
-219
lines changed

2 files changed

+25
-219
lines changed

src/guide/installation.md

Lines changed: 2 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Release Notes
44

5-
Latest beta version: 3.0.0-beta.14
5+
Latest beta version: 3.0.0-beta.121
66

77
Detailed release notes for each version are available on [GitHub](https://github.com/vuejs/vue-next/releases).
88

@@ -22,18 +22,13 @@ For prototyping or learning purposes, you can use the latest version with:
2222

2323
For production, we recommend linking to a specific version number and build to avoid unexpected breakage from newer versions.
2424

25-
Make sure to read about [the different builds of Vue](#explanation-of-different-builds) and use the **production
26-
version** in your published site, replacing `vue.js` with `vue.min.js`. This is a smaller build optimized for speed instead of development experience.
27-
2825
## NPM
2926

30-
> Currently not available for Vue 3
31-
3227
NPM is the recommended installation method when building large scale applications with Vue. It pairs nicely with module bundlers such as [Webpack](https://webpack.js.org/) or [Browserify](http://browserify.org/). Vue also provides accompanying tools for authoring [Single File Components](../guide/single-file-component.html).
3328

3429
```bash
3530
# latest stable
36-
$ npm install vue
31+
$ npm install vue@next
3732
```
3833

3934
## CLI
@@ -45,201 +40,3 @@ The CLI assumes prior knowledge of Node.js and the associated build tools. If yo
4540
:::
4641

4742
For beta, Vue CLI now has experimental support via [vue-cli-plugin-vue-next](https://github.com/vuejs/vue-cli-plugin-vue-next).
48-
49-
## Explanation of Different Builds
50-
51-
In the [`dist/` directory of the NPM package](TODO) you will find many different builds of Vue.js. Here's an overview of the difference between them:
52-
53-
| | UMD | CommonJS | ES Module (for bundlers) | ES Module (for browsers) |
54-
| ----------------------------- | ------------------ | --------------------- | ------------------------ | ------------------------ |
55-
| **Full** | vue.js | vue.common.js | vue.esm.js | vue.esm.browser.js |
56-
| **Runtime-only** | vue.runtime.js | vue.runtime.common.js | vue.runtime.esm.js | - |
57-
| **Full (production)** | vue.min.js | - | - | vue.esm.browser.min.js |
58-
| **Runtime-only (production)** | vue.runtime.min.js | - | - | - |
59-
60-
### Terms
61-
62-
- **Full**: builds that contain both the compiler and the runtime.
63-
64-
- **Compiler**: code that is responsible for compiling template strings into JavaScript render functions.
65-
66-
- **Runtime**: code that is responsible for creating Vue instances, rendering and patching virtual DOM, etc. Basically everything minus the compiler.
67-
68-
- **[UMD](https://github.com/umdjs/umd)**: UMD builds can be used directly in the browser via a `<script>` tag. The default file from jsDelivr CDN at [https://cdn.jsdelivr.net/npm/vue](https://cdn.jsdelivr.net/npm/vue) is the Runtime + Compiler UMD build (`vue.js`).
69-
70-
- **[CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1)**: CommonJS builds are intended for use with older bundlers like [browserify](http://browserify.org/) or [webpack 1](https://webpack.github.io). The default file for these bundlers (`pkg.main`) is the Runtime only CommonJS build (`vue.runtime.common.js`).
71-
72-
- **[ES Module](http://exploringjs.com/es6/ch_modules.html)**: starting in 2.6 Vue provides two ES Modules (ESM) builds:
73-
74-
- ESM for bundlers: intended for use with modern bundlers like [webpack 2](https://webpack.js.org) or [Rollup](https://rollupjs.org/). ESM format is designed to be statically analyzable so the bundlers can take advantage of that to perform "tree-shaking" and eliminate unused code from your final bundle. The default file for these bundlers (`pkg.module`) is the Runtime only ES Module build (`vue.runtime.esm.js`).
75-
76-
- ESM for browsers (2.6+ only): intended for direct imports in modern browsers via `<script type="module">`.
77-
78-
### Runtime + Compiler vs. Runtime-only
79-
80-
If you need to compile templates on the client (e.g. passing a string to the `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:
81-
82-
```js
83-
// this requires the compiler
84-
Vue.createApp({
85-
template: '<div>{{ hi }}</div>'
86-
})
87-
88-
// this does not
89-
Vue.createApp({
90-
render() {
91-
return Vue.h('div', this.hi)
92-
}
93-
})
94-
```
95-
96-
When using `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.
97-
98-
Since the runtime-only builds are roughly 30% lighter-weight than their full-build counterparts, you should use it whenever you can. If you still wish to use the full build instead, you need to configure an alias in your bundler:
99-
100-
#### Webpack
101-
102-
```js
103-
module.exports = {
104-
// ...
105-
resolve: {
106-
alias: {
107-
vue$: 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
108-
}
109-
}
110-
}
111-
```
112-
113-
#### Rollup
114-
115-
```js
116-
const alias = require('rollup-plugin-alias')
117-
118-
rollup({
119-
// ...
120-
plugins: [
121-
alias({
122-
vue: require.resolve('vue/dist/vue.esm.js')
123-
})
124-
]
125-
})
126-
```
127-
128-
#### Browserify
129-
130-
Add to your project's `package.json`:
131-
132-
```js
133-
{
134-
// ...
135-
"browser": {
136-
"vue": "vue/dist/vue.common.js"
137-
}
138-
}
139-
```
140-
141-
#### Parcel
142-
143-
Add to your project's `package.json`:
144-
145-
```js
146-
{
147-
// ...
148-
"alias": {
149-
"vue" : "./node_modules/vue/dist/vue.common.js"
150-
}
151-
}
152-
```
153-
154-
### Development vs. Production Mode
155-
156-
Development/production modes are hard-coded for the UMD builds: the un-minified files are for development, and the minified files are for production.
157-
158-
CommonJS and ES Module builds are intended for bundlers, therefore we don't provide minified versions for them. You will be responsible for minifying the final bundle yourself.
159-
160-
CommonJS and ES Module builds also preserve raw checks for `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.
161-
162-
#### Webpack
163-
164-
In Webpack 4+, you can use the `mode` option:
165-
166-
```js
167-
module.exports = {
168-
mode: 'production'
169-
}
170-
```
171-
172-
But in Webpack 3 and earlier, you'll need to use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/):
173-
174-
```js
175-
var webpack = require('webpack')
176-
177-
module.exports = {
178-
// ...
179-
plugins: [
180-
// ...
181-
new webpack.DefinePlugin({
182-
'process.env': {
183-
NODE_ENV: JSON.stringify('production')
184-
}
185-
})
186-
]
187-
}
188-
```
189-
190-
#### Rollup
191-
192-
Use [rollup-plugin-replace](https://github.com/rollup/rollup-plugin-replace):
193-
194-
```js
195-
const replace = require('rollup-plugin-replace')
196-
197-
rollup({
198-
// ...
199-
plugins: [
200-
replace({
201-
'process.env.NODE_ENV': JSON.stringify('production')
202-
})
203-
]
204-
}).then(...)
205-
```
206-
207-
#### Browserify
208-
209-
Apply a global [envify](https://github.com/hughsk/envify) transform to your bundle.
210-
211-
```bash
212-
NODE_ENV=production browserify -g envify -e main.js | uglifyjs -c -m > build.js
213-
```
214-
215-
Also see [Production Deployment Tips](deployment.html).
216-
217-
### CSP environments
218-
219-
Some environments, such as Google Chrome Apps, enforce Content Security Policy (CSP), which prohibits the use of `new Function()` for evaluating expressions. The full build depends on this feature to compile templates, so is unusable in these environments.
220-
221-
On the other hand, the runtime-only build is fully CSP-compliant. When using the runtime-only build with [Webpack + vue-loader](https://github.com/vuejs-templates/webpack-simple) or [Browserify + vueify](https://github.com/vuejs-templates/browserify-simple), your templates will be precompiled into `render` functions which work perfectly in CSP environments.
222-
223-
## Dev Build
224-
225-
**Important**: the built files in GitHub's `/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!
226-
227-
```bash
228-
git clone https://github.com/vuejs/vue.git node_modules/vue
229-
cd node_modules/vue
230-
npm install
231-
npm run build
232-
```
233-
234-
## Bower
235-
236-
Only UMD builds are available from Bower.
237-
238-
```bash
239-
# latest stable
240-
$ bower install vue
241-
```
242-
243-
## AMD Module Loaders
244-
245-
All UMD builds can be used directly as an AMD module.

src/guide/migration/introduction.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
55
We're glad you asked! The answer is no. We've gone to great lengths to ensure most of the API is the same and the core concepts haven't changed. It's long because we like to offer very detailed explanations and include a lot of examples. Rest assured, **this is not something you have to read from top to bottom!**
66

7-
[//]: # 'TODO: update composition API with a link'
8-
9-
Possibly the biggest change is our new Composition API, which is entirely additive- the previous Options API will continue to be supported, as the Composition API is an advanced feature.
7+
Possibly the biggest change is our new [Composition API](/guide/composition-api-introduction.html), which is entirely additive- the previous Options API will continue to be supported, as the Composition API is an advanced feature.
108

119
## Overview
1210

@@ -15,22 +13,35 @@ Possibly the biggest change is our new Composition API, which is entirely additi
1513
Some of the new features to keep an eye on in Vue 3 include:
1614

1715
- [Composition API](/guide/composition-api-introduction.html)
18-
- [Teleport](/guide/teleport)
19-
- [Fragments](/guide/migration/fragments)
16+
- [Teleport](/guide/teleport.html)
17+
- [Fragments](/guide/migration/fragments.html)
2018
- [Emits Component Option](/guide/component-custom-events.html)
2119
- `createRenderer` API from `@vue/runtime-core` to create custom renderers
2220

2321
### Breaking
2422

2523
The following consists a list of breaking changes from 2.x:
2624

27-
- **keyCode support as `v-on` modifiers.** For more information, [see in-depth explanation](/guides/migration/keycodes.html)
25+
- [Global Vue API is changed to use an application instance](/guide/migration/global-api.html)
26+
- [Global and internal APIs have been restructured to be tree-shakable](/guide/migration/treeshaking.html)
27+
- [`model` component option and `v-bind`'s `sync` modifier are removed in favor of `v-model` arguments](/guide/migration/v-model.html)
28+
- [Functional components can only be created using a plain function](/guide/migration/functional-components.html)
29+
- [Async components now require `defineAsyncComponent` method to be created](/guide/migration/async-components.html)
30+
- [Component data option should always be declared as a function](/guide/migration/data-option.html)
31+
- [Custom elements whitelisting is now performed during template compilation](/guide/migration/custom-elements-interop.html)
32+
- [Special `is` prop usage is restricted to the reserved `<component>` tag only](/guide/migration/custom-elements-interop.html)
33+
34+
### Removed
35+
36+
- [`keyCode` support as `v-on` modifiers](/guide/migration/keycodes.html)
37+
- [$on, $off and $once instance methods](/guide/migration/events-api.html)
38+
- [Filters](/guide/migration/filters.html)
2839

2940
## FAQ
3041

31-
> Where should I start in a migration?
42+
### Where should I start in a migration?
3243

33-
[//]: # 'TODO: update this link when we have a migration helper'
44+
> Migration helper is still under development
3445
3546
1. Start by running the [migration helper](https://github.com/vuejs/vue-migration-helper) on a current project. We've carefully minified and compressed a senior Vue dev into a simple command line interface. Whenever they recognize an obsolete feature, they'll let you know, offer suggestions, and provide links to more info.
3647

@@ -40,18 +51,16 @@ The following consists a list of breaking changes from 2.x:
4051

4152
4. By now, your app should be fully migrated. If you're still hungry for more though, you can read the rest of this page - or dive in to the new and improved guide from [the beginning](index.html). Many parts will be skimmable, since you're already familiar with the core concepts.
4253

43-
> How long will it take to migrate a Vue 2.x app to 3.0?
54+
### How long will it take to migrate a Vue 2.x app to 3.0?
4455

4556
It depends on a few factors:
4657

4758
- The size of your app (small to medium-sized apps will probably be less than a day)
4859

4960
- How many times you get distracted and start playing with a cool new feature. 😉 &nbsp;Not judging, it also happened to us while building 3.0!
5061

51-
[//]: # 'TODO: update this with link to styleguide'
52-
53-
- Which obsolete features you're using. Most can be upgraded with find-and-replace, but others might take a few minutes. If you're not currently following best practices according to our styleguide, Vue 3.0 will also try harder to force you to. This is a good thing in the long run, but could also mean a significant (though possibly overdue) refactor.
62+
- Which obsolete features you're using. Most can be upgraded with find-and-replace, but others might take a few minutes. If you're not currently following best practices according to [our styleguide](/style-guide/README.html), Vue 3.0 will also try harder to force you to. This is a good thing in the long run, but could also mean a significant (though possibly overdue) refactor.
5463

55-
> If I upgrade to Vue 3, will I also have to upgrade Vuex and Vue Router?
64+
### If I upgrade to Vue 3, will I also have to upgrade Vuex and Vue Router?
5665

57-
[//]: # 'TODO: still need to see where this lands'
66+
Yes, currently both [Vuex](https://github.com/vuejs/vuex/tree/4.0#vuex-4) and [Vue Router](https://github.com/vuejs/vue-router-next) are in beta

0 commit comments

Comments
 (0)