diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ba8b9e75..84c1fb2de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,113 @@ + + + +## 5.0.7 (2022-07-05) + +* `@vue/cli-service` + * [#7202](https://github.com/vuejs/vue-cli/pull/7202), [[558dea2](https://github.com/vuejs/vue-cli/commit/558dea2)] fix: support `devServer.server` option, avoid deprecation warnings ([@backrunner](https://github.com/backrunner), [@sodatea](https://github.com/sodatea)) + * [[beffe8a](https://github.com/vuejs/vue-cli/commit/beffe8a)] fix: allow disabling progress plugin via `devServer.client.progress` +* `@vue/cli-ui` + * [#7210](https://github.com/vuejs/vue-cli/pull/7210) chore: upgrade to apollo-server-express 3.x + +#### Committers: 2 +- BackRunner ([@backrunner](https://github.com/backrunner)) +- Haoqun Jiang ([@sodatea](https://github.com/sodatea)) + + + +## 5.0.6 (2022-06-16) + +Fix compatibility with the upcoming Vue 2.7 (currently in alpha) and Vue Loader 15.10 (currently in beta). + +In Vue 2.7, `vue-template-compiler` is no longer a required peer dependency. Rather, there's a new export under the main package as `vue/compiler-sfc`. + + + +## 5.0.5 (2022-06-16) + +#### :bug: Bug Fix +* `@vue/cli` + * [#7167](https://github.com/vuejs/vue-cli/pull/7167) feat(upgrade): prevent changing the structure of package.json file during upgrade ([@blzsaa](https://github.com/blzsaa)) +* `@vue/cli-service` + * [#7023](https://github.com/vuejs/vue-cli/pull/7023) fix: windows vue.config.mjs support ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe)) + +#### Committers: 3 +- Martijn Jacobs ([@maerteijn](https://github.com/maerteijn)) +- ZHAO Jinxiang ([@xiaoxiangmoe](https://github.com/xiaoxiangmoe)) +- [@blzsaa](https://github.com/blzsaa) + + + +## 5.0.4 (2022-03-22) + +#### :bug: Bug Fix +* `@vue/cli-service` + * [#7005](https://github.com/vuejs/vue-cli/pull/7005) Better handling of `publicPath: 'auto'` ([@AndreiSoroka](https://github.com/AndreiSoroka)) +* `@vue/cli-shared-utils`, `@vue/cli-ui` + * [75826d6](https://github.com/vuejs/vue-cli/commit/75826d6) fix: replace `node-ipc` with `@achrinza/node-ipc` to further secure the dependency chain + +#### Committers: 1 +- Andrei ([@AndreiSoroka](https://github.com/AndreiSoroka)) +- Haoqun Jiang ([@sodatea](https://github.com/sodatea)) + +## 5.0.3 (2022-03-15) + +#### :bug: Bug Fix +* `@vue/cli-shared-utils`, `@vue/cli-ui` + * Lock `node-ipc` to v9.2.1 + +## 5.0.2 (2022-03-15) + +#### :bug: Bug Fix +* `@vue/cli-service` + * [#7044](https://github.com/vuejs/vue-cli/pull/7044) fix(cli-service): devServer proxy should be optional ([@ntnyq](https://github.com/ntnyq)) + * [#7039](https://github.com/vuejs/vue-cli/pull/7039) chore: add scss to LoaderOptions ([@hiblacker](https://github.com/hiblacker)) + +#### Committers: 2 +- Blacker ([@hiblacker](https://github.com/hiblacker)) +- ntnyq ([@ntnyq](https://github.com/ntnyq)) + + +## 5.0.1 (2022-02-17) + +Same as 5.0.0. + +## 5.0.0 (2022-02-17) + +#### :bug: Bug Fix +* `@vue/cli-service` + * [#6972](https://github.com/vuejs/vue-cli/pull/6972) Remove --skip-plugin from arguments ([@MatthijsBurgh](https://github.com/MatthijsBurgh)) + * [#6987](https://github.com/vuejs/vue-cli/pull/6987) fix: update mini-css-extract-plugin to ^2.5.3 ([@darrinmn9](https://github.com/darrinmn9)) + +#### :memo: Documentation +* [#6706](https://github.com/vuejs/vue-cli/pull/6706) docs: update vue create --help output in "Basics/Creating a Project" ([@Lalaluka](https://github.com/Lalaluka)) +* [#6642](https://github.com/vuejs/vue-cli/pull/6642) docs: Update README.md ([@wxsms](https://github.com/wxsms)) +* [#6620](https://github.com/vuejs/vue-cli/pull/6620) Fix typo in deployment guide ([@Klikini](https://github.com/Klikini)) +* [#6623](https://github.com/vuejs/vue-cli/pull/6623) fix(docs): the plugin-dev in zh has a regexp lose the end / ([@HelloJiya](https://github.com/HelloJiya)) +* [#6377](https://github.com/vuejs/vue-cli/pull/6377) replace master with main to reflect GH default ([@anbnyc](https://github.com/anbnyc)) +* [#6359](https://github.com/vuejs/vue-cli/pull/6359) Fix master to main in heroku deployment ([@MowlCoder](https://github.com/MowlCoder)) +* [#6266](https://github.com/vuejs/vue-cli/pull/6266) Add note about loader incompatible with webpack 4 ([@JarnoRFB](https://github.com/JarnoRFB)) +* [#6239](https://github.com/vuejs/vue-cli/pull/6239) Update deployment.md ([@anzuj](https://github.com/anzuj)) +* [#6237](https://github.com/vuejs/vue-cli/pull/6237) fix code demo ([@yyzclyang](https://github.com/yyzclyang)) + +#### Committers: 13 +- Alec Barrett ([@anbnyc](https://github.com/anbnyc)) +- Alexander Sokolov ([@Alex-Sokolov](https://github.com/Alex-Sokolov)) +- Andy Castille ([@Klikini](https://github.com/Klikini)) +- Anzelika ([@anzuj](https://github.com/anzuj)) +- Ben Hutton ([@Relequestual](https://github.com/Relequestual)) +- Calvin Schröder ([@Lalaluka](https://github.com/Lalaluka)) +- Darrin Nagengast ([@darrinmn9](https://github.com/darrinmn9)) +- Matthijs van der Burgh ([@MatthijsBurgh](https://github.com/MatthijsBurgh)) +- Rüdiger Busche ([@JarnoRFB](https://github.com/JarnoRFB)) +- [@HelloJiya](https://github.com/HelloJiya) +- [@MowlCoder](https://github.com/MowlCoder) +- wxsm ([@wxsms](https://github.com/wxsms)) +- 鱼依藻常乐 ([@yyzclyang](https://github.com/yyzclyang)) + + + ## 5.0.0-rc.3 (2022-02-10) #### :rocket: New Features @@ -748,6 +857,54 @@ Ngo Wei Lin ([@Creastery](https://twitter.com/creastery)) of STAR Labs ([@starla - Yazhe Wang ([@jeneser](https://github.com/jeneser)) +## 4.5.19 (2022-06-28) + +IMPORTANT NOTE: [IE 11 has reached End-of-Life](https://docs.microsoft.com/en-us/lifecycle/faq/internet-explorer-microsoft-edge#what-is-the-lifecycle-policy-for-internet-explorer-). The default `browserslist` query no longer includes IE 11 as a target. +If your project still has to support IE 11, you **MUST** manually add `IE 11` to the last line of the `.browserslistrc` file in the project (or `browserslist` field in `package.json`) + +#### :bug: Bug Fix + +* `@vue/babel-preset-app` + * [[c7fa1cf](https://github.com/vuejs/vue-cli/commit/c7fa1cf)] fix: always transpile syntaxes introduced in ES2020 or later, so that optional chaining and nullish coalescing syntaxes won't cause errors in webpack 4 and ESLint 6. +* `@vue/cli-plugin-typescript` + * [[5b57792](https://github.com/vuejs/vue-cli/commit/5b57792)] fix: typechecking with Vue 2.7, fixes #7213 + + +## 4.5.18 (2022-06-16) + +Fix compatibility with the upcoming Vue 2.7 (currently in alpha) and Vue Loader 15.10 (currently in beta). + +In Vue 2.7, `vue-template-compiler` is no longer a required peer dependency. Rather, there's a new export under the main package as `vue/compiler-sfc`. + + +## 4.5.17 (2022-03-23) + +#### :bug: Bug Fix +* `@vue/cli-shared-utils`, `@vue/cli-ui` + * [d7a9881](https://github.com/vuejs/vue-cli/commit/d7a9881) fix: replace `node-ipc` with `@achrinza/node-ipc` to further secure the dependency chain + +#### Committers: 1 +- Haoqun Jiang ([@sodatea](https://github.com/sodatea)) + + +## 4.5.16 (2022-03-15) + +#### :bug: Bug Fix +* `@vue/cli-service` + * Fix demo-lib.html and demo-wc.html for Vue 2 +* `@vue/cli-shared-utils`, `@vue/cli-ui` + * Lock `node-ipc` to v9.2.1 + + +## 4.5.15 (2021-10-28) + +#### Bug Fixes + +* fix: set `.mjs` file type to `javascript/auto` [[15b1e1b]](https://github.com/vuejs/vue-cli/commit/15b1e1b6bfa40fe0b69db304a2439c66ff9ba65f) + +This change allows an `.mjs` file to import named exports from `.cjs` and plain `.js` files. +Fixes compatibility with `pinia`. + ## 4.5.14 (2021-10-14) diff --git a/README.md b/README.md index 71d56a0193..0962eaf2fa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ # Vue CLI [![Build Status](https://circleci.com/gh/vuejs/vue-cli/tree/dev.svg?style=shield)](https://circleci.com/gh/vuejs/vue-cli/tree/dev) [![Windows Build status](https://ci.appveyor.com/api/projects/status/rkpafdpdwie9lqx0/branch/dev?svg=true)](https://ci.appveyor.com/project/yyx990803/vue-cli/branch/dev) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/) -## Status +## ⚠️ Status -Vue CLI is now in maintenance mode. For new Vue 3 projects, please use [create-vue](https://github.com/vuejs/create-vue) to scaffold [Vite](https://vitejs.dev/)-based projects. +Vue CLI is now in maintenance mode. For new projects, please use [create-vue](https://github.com/vuejs/create-vue) to scaffold [Vite](https://vitejs.dev/)-based projects. `create-vue` supports both Vue 2 and Vue 3. + +Also refer to the [Vue 3 Tooling Guide](https://vuejs.org/guide/scaling-up/tooling.html) for the latest recommendations. + +For information on migrating from Vue CLI to Vite: + +- [Vue CLI -> Vite Migration Guide from VueSchool.io](https://vueschool.io/articles/vuejs-tutorials/how-to-migrate-from-vue-cli-to-vite/) +- [Tools / Plugins that help with auto migration](https://github.com/vitejs/awesome-vite#vue-cli) ## Documentation diff --git a/appveyor.yml b/appveyor.yml index 62424c42ca..f54d23cd69 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - nodejs_version: "12" + nodejs_version: "14" install: - ps: Install-Product node $env:nodejs_version diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js index f9abee78f0..86aa96a8c6 100644 --- a/docs/.vitepress/theme/index.js +++ b/docs/.vitepress/theme/index.js @@ -2,19 +2,92 @@ import { h } from 'vue' import DefaultTheme from 'vitepress/dist/client/theme-default' import AlgoliaSearchBox from './AlgoliaSearchBox.vue' import './custom.css' +import { useData } from 'vitepress' export default { ...DefaultTheme, - Layout() { - return h(DefaultTheme.Layout, null, { - 'navbar-search': () => { - return h(AlgoliaSearchBox, { - options: { - indexName: 'cli_vuejs', - apiKey: 'f6df220f7d246aff64a56300b7f19f21', + Layout: { + setup() { + const { lang } = useData() + return () => { + return h(DefaultTheme.Layout, null, { + 'page-top': () => { + return lang.value === 'zh-CN' ? notice_zh_cn() : notice_en() + }, + 'navbar-search': () => { + return h(AlgoliaSearchBox, { + options: { + indexName: 'cli_vuejs', + apiKey: 'f6df220f7d246aff64a56300b7f19f21' + } + }) } }) } - }) + } } } + +function notice_en() { + return h('div', { class: 'warning custom-block' }, [ + h( + 'p', + { class: 'custom-block-title' }, + '⚠️ Vue CLI is in Maintenance Mode!' + ), + h('p', [ + 'For new projects, it is now recommended to use ', + h( + 'a', + { + href: 'https://github.com/vuejs/create-vue', + target: '_blank' + }, + [h('code', 'create-vue')] + ), + ' to scaffold ', + h('a', { href: 'https://vitejs.dev', target: '_blank' }, 'Vite'), + '-based projects. ', + 'Also refer to the ', + h( + 'a', + { + href: 'https://vuejs.org/guide/scaling-up/tooling.html', + target: '_blank' + }, + 'Vue 3 Tooling Guide' + ), + ' for the latest recommendations.' + ]) + ]) +} + +function notice_zh_cn() { + return h('div', { class: 'warning custom-block' }, [ + h('p', { class: 'custom-block-title' }, '⚠️ Vue CLI 现已处于维护模式!'), + h('p', [ + '现在官方推荐使用 ', + h( + 'a', + { + href: 'https://github.com/vuejs/create-vue', + target: '_blank' + }, + [h('code', 'create-vue')] + ), + ' 来创建基于 ', + h('a', { href: 'https://cn.vitejs.dev', target: '_blank' }, 'Vite'), + ' 的新项目。 ', + '另外请参考 ', + h( + 'a', + { + href: 'https://cn.vuejs.org/guide/scaling-up/tooling.html', + target: '_blank' + }, + 'Vue 3 工具链指南' + ), + ' 以了解最新的工具推荐。' + ]) + ]) +} diff --git a/docs/config/index.md b/docs/config/index.md index 7f446bbdc2..8fb0a57f45 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -22,6 +22,10 @@ The file should export an object containing options: ``` js // vue.config.js + +/** + * @type {import('@vue/cli-service').ProjectOptions} + */ module.exports = { // options... } diff --git a/docs/guide/cli-service.md b/docs/guide/cli-service.md index c76a697e78..39cc9d8f98 100644 --- a/docs/guide/cli-service.md +++ b/docs/guide/cli-service.md @@ -26,7 +26,7 @@ yarn serve If you have [npx](https://github.com/npm/npx) available (should be bundled with an up-to-date version of npm), you can also invoke the binary directly with: ```bash -npx vue-cli-service serve +npx --no vue-cli-service serve ``` ::: tip @@ -114,13 +114,13 @@ You can use `vue-cli-service inspect` to inspect the webpack config inside a Vue Some CLI plugins will inject additional commands to `vue-cli-service`. For example, `@vue/cli-plugin-eslint` injects the `vue-cli-service lint` command. You can see all injected commands by running: ```bash -npx vue-cli-service help +npx --no vue-cli-service help ``` You can also learn about the available options of each command with: ```bash -npx vue-cli-service help [command] +npx --no vue-cli-service help [command] ``` ## Skipping Plugins @@ -128,28 +128,28 @@ npx vue-cli-service help [command] You can exclude specific plugins when running a command by passing the name of the plugin to the `--skip-plugins` option: ```bash -npx vue-cli-service build --skip-plugins pwa +npx --no vue-cli-service build --skip-plugins pwa ``` ::: tip This option is available for _every_ `vue-cli-service` command, including custom ones added by other plugins. ::: -You can skip multiple plugins by passing their names as a comma-separated list: +You can skip multiple plugins by passing their names as a comma-separated list or by repeating the argument: ```bash -npx vue-cli-service build --skip-plugins pwa,apollo +npx --no vue-cli-service build --skip-plugins pwa,apollo --skip-plugins eslint ``` Plugin names are resolved the same way they are during install, as described [here](./plugins-and-presets.md#installing-plugins-in-an-existing-project) ```bash # these are all equivalent -npx vue-cli-service build --skip-plugins pwa +npx --no vue-cli-service build --skip-plugins pwa -npx vue-cli-service build --skip-plugins @vue/pwa +npx --no vue-cli-service build --skip-plugins @vue/pwa -npx vue-cli-service build --skip-plugins @vue/cli-plugin-pwa +npx --no vue-cli-service build --skip-plugins @vue/cli-plugin-pwa ``` ## Caching and Parallelization diff --git a/docs/guide/creating-a-project.md b/docs/guide/creating-a-project.md index ab0409e0b5..7278c43e70 100644 --- a/docs/guide/creating-a-project.md +++ b/docs/guide/creating-a-project.md @@ -53,9 +53,11 @@ Options: -g, --git [message|false] Force / skip git initialization, optionally specify initial commit message -n, --no-git Skip git initialization -f, --force Overwrite target directory if it exists + --merge Merge target directory if it exists -c, --clone Use git clone when fetching remote preset -x, --proxy Use specified proxy when creating project -b, --bare Scaffold project without beginner instructions + --skipGetStarted Skip displaying "Get started" instructions -h, --help Output usage information ``` diff --git a/docs/guide/css.md b/docs/guide/css.md index 2f212be5bb..efbf20d085 100644 --- a/docs/guide/css.md +++ b/docs/guide/css.md @@ -21,6 +21,15 @@ npm install -D less-loader less npm install -D stylus-loader stylus ``` +::: tip Note on webpack 4 +When using `webpack` version 4, the default in Vue CLI 4, you need to make sure your loaders are compatible with it. Otherwise you will get errors about confliciting peer dependencies. In this case you can use an older version of the loader that is still compatible with `webpack` 4. + +``` bash +# Sass +npm install -D sass-loader@^10 sass +``` +::: + Then you can import the corresponding file types, or use them in `*.vue` files with: ``` vue diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index b57f130039..f0ec80d7a6 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -39,7 +39,7 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser 1. Set correct `publicPath` in `vue.config.js`. - If you are deploying to `https://.github.io/`, you can omit `publicPath` as it defaults to `"/"`. + If you are deploying to `https://.github.io/` or to a custom domain, you can omit `publicPath` as it defaults to `"/"`. If you are deploying to `https://.github.io//`, (i.e. your repository is at `https://github.com//`), set `publicPath` to `"//"`. For example, if your repo name is "my-project", your `vue.config.js` should look like this: @@ -75,10 +75,10 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser git commit -m 'deploy' # if you are deploying to https://.github.io - # git push -f git@github.com:/.github.io.git master + # git push -f git@github.com:/.github.io.git main # if you are deploying to https://.github.io/ - # git push -f git@github.com:/.git master:gh-pages + # git push -f git@github.com:/.git main:gh-pages cd - ``` @@ -112,7 +112,7 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser github_token: $GITHUB_TOKEN local_dir: dist on: - branch: master + branch: main ``` 6. Push the `.travis.yml` file to your repository to trigger the first build. @@ -363,7 +363,7 @@ heroku login heroku create heroku buildpacks:add heroku/nodejs heroku buildpacks:add https://github.com/heroku/heroku-buildpack-static -git push heroku master +git push heroku main ``` More info: [Getting started with SPAs on Heroku](https://gist.github.com/hone/24b06869b4c1eca701f9) diff --git a/docs/guide/index.md b/docs/guide/index.md index 620cbd3980..03625ef225 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -4,10 +4,6 @@ sidebarDepth: 0 # Overview -::: warning -This documentation is for `@vue/cli`. For the old `vue-cli`, see [here](https://github.com/vuejs/vue-cli/tree/v2#vue-cli--). -::: - Vue CLI is a full system for rapid Vue.js development, providing: - Interactive project scaffolding via `@vue/cli`. diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 780b3ed938..1681a62cee 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -1,10 +1,5 @@ # Installation -::: warning Warning regarding Previous Versions -The package name changed from `vue-cli` to `@vue/cli`. -If you have the previous `vue-cli` (1.x or 2.x) package installed globally, you need to uninstall it first with `npm uninstall vue-cli -g` or `yarn global remove vue-cli`. -::: - ::: tip Node Version Requirement Vue CLI 4.x requires [Node.js](https://nodejs.org/) version 8.9 or above (v10+ recommended). You can manage multiple versions of Node on the same machine with [n](https://github.com/tj/n), [nvm](https://github.com/creationix/nvm) or [nvm-windows](https://github.com/coreybutler/nvm-windows). ::: diff --git a/docs/guide/mode-and-env.md b/docs/guide/mode-and-env.md index 81d9469daa..c6131ea2f1 100644 --- a/docs/guide/mode-and-env.md +++ b/docs/guide/mode-and-env.md @@ -86,7 +86,7 @@ And the following `.env.staging` file: ``` NODE_ENV=production -VUE_APP_TITLE=My App (staging) +VUE_APP_TITLE=My Staging App ``` - `vue-cli-service build` builds a production app, loading `.env`, `.env.production` and `.env.production.local` if they are present; diff --git a/docs/index.md b/docs/index.md index 7227867878..c321469d11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,24 +3,13 @@ home: true heroImage: /favicon.png actionText: Get Started → actionLink: /guide/ - -features: - - title: Feature Rich - details: Out-of-the-box support for Babel, TypeScript, ESLint, PostCSS, PWA, Unit Testing & End-to-end Testing. - - title: Extensible - details: The plugin system allows the community to build and share reusable solutions to common needs. - - title: No Need to Eject - details: Vue CLI is fully configurable without the need for ejecting. This allows your project to stay up-to-date for the long run. - - title: Graphical User Interface - details: Create, develop and manage your projects through an accompanying graphical user interface. - - title: - details: - - title: Future Ready - details: Effortlessly ship native ES2015 code for modern browsers, or build your vue components as native web components. - footer: MIT Licensed | Copyright © 2018-present Evan You --- +:::warning Vue CLI is in Maintenance Mode! +For new projects, please use [create-vue](https://github.com/vuejs/create-vue) to scaffold [Vite](https://vitejs.dev/)-based projects. Also refer to the [Vue 3 Tooling Guide](https://vuejs.org/guide/scaling-up/tooling.html) for the latest recommendations. +::: + ## Getting Started Install: diff --git a/docs/migrations/migrate-from-v4.md b/docs/migrations/migrate-from-v4.md index e84167530b..036ac23e00 100644 --- a/docs/migrations/migrate-from-v4.md +++ b/docs/migrations/migrate-from-v4.md @@ -7,9 +7,9 @@ sidebar: auto First, install the latest Vue CLI globally: ```bash -npm install -g @vue/cli@next +npm install -g @vue/cli # OR -yarn global add @vue/cli@next +yarn global add @vue/cli ``` ## Upgrade All Plugins at Once @@ -17,7 +17,7 @@ yarn global add @vue/cli@next In your existing projects, run: ```bash -vue upgrade --next +vue upgrade ``` And then follow the command line instructions. @@ -132,7 +132,7 @@ The [`transpileDependencies` option](../config/#transpiledependencies) now accep * `eslint-loader` is replaced by [eslint-webpack-plugin](https://github.com/webpack-contrib/eslint-webpack-plugin), dropping support for ESLint <= 6. * New projects are now generated with `eslint-plugin-vue` v8, see the release notes ([v7](https://github.com/vuejs/eslint-plugin-vue/releases/tag/v7.0.0), [v8](https://github.com/vuejs/eslint-plugin-vue/releases/tag/v8.0.0)) for breaking changes. -* `@vue/eslint-config-prettier` is deprecated. See for the migration guide. +* If you are using `@vue/eslint-config-prettier`, please [migrate to `eslint-plugin-prettier`](https://github.com/vuejs/eslint-config-prettier/tree/81390fc2c16798ba189188acdc5da5ae5bca1127?tab=readme-ov-file#deprecated). ### PWA Plugin diff --git a/docs/ru/config/index.md b/docs/ru/config/index.md index 2f31f0dd49..f290869fee 100644 --- a/docs/ru/config/index.md +++ b/docs/ru/config/index.md @@ -22,6 +22,10 @@ sidebar: auto ```js // vue.config.js + +/** + * @type {import('@vue/cli-service').ProjectOptions} + */ module.exports = { // настройки... } @@ -267,7 +271,7 @@ module.exports = { - Тип: `boolean | Object` - По умолчанию: `true` в режиме production, `false` в режиме development - Извлечение CSS из ваших компонентов в отдельные CSS-файлы (вместо инлайна в JavaScript и динамического внедрения). + Извлечение CSS из ваших компонентов в отдельный CSS-файл (вместо инлайна в JavaScript и динамического внедрения). Это всегда отключается при сборке веб-компонентов (в этом случае инлайн стили внедряются в shadowRoot). @@ -373,6 +377,16 @@ module.exports = { } ``` +### devServer.inline + +- Тип: `boolean` +- По умолчанию: `true` + + Переключение между двумя режимами работы сервера разработки. Более подробная информация об опции — [devServer.inline](https://webpack.js.org/configuration/dev-server/#devserverinline). Обратите внимание: + + - При использовании `iframe mode` дополнительная конфигурация не требуется. Просто перейдите в браузере по адресу `http://:/webpack-dev-server/` для отладки приложения. В верхней части страницы будут появляться уведомления. + - При использовании `inline mode`, просто перейдите в браузере по адресу `http://:/` для отладки приложения. Сообщения о сборке будут появляться в консоли браузера. + ### parallel - Тип: `boolean | number` diff --git a/docs/ru/core-plugins/eslint.md b/docs/ru/core-plugins/eslint.md index a383a0ea6c..e52b5743b9 100644 --- a/docs/ru/core-plugins/eslint.md +++ b/docs/ru/core-plugins/eslint.md @@ -17,9 +17,13 @@ --max-warnings количество предупреждений, по достижению которого сборка заканчивается ошибкой (по умолчанию: Infinity) ``` - Проверяет и исправляет файлы. Если конкретные файлы для проверки не указаны, то будут проверяться все файлы в `src` и `tests`. + Проверяет и исправляет файлы. Если не указаны конкретные файлы для проверки, то будут проверяться все файлы в `src` и `tests`, а также все файлы JavaScript в корневом каталоге (чаще всего это файлы конфигурации, например `babel.config.js` или `.eslintrc.js`). - Другие [настройки ESLint CLI](https://eslint.org/docs/user-guide/command-line-interface#options) также поддерживаются. + Также поддерживаются и другие [настройки ESLint CLI](https://eslint.org/docs/user-guide/command-line-interface#options). + + :::tip Совет + По умолчанию `vue-cli-service lint` проверяет файлы, именуемые с точки `.*.js`. Если вместо этого требуется поведение ESLint по умолчанию, то следует добавить в проект файл `.eslintignore`. + ::: ## Конфигурация diff --git a/docs/ru/guide/cli-service.md b/docs/ru/guide/cli-service.md index bca0c08064..e0a66d21c5 100644 --- a/docs/ru/guide/cli-service.md +++ b/docs/ru/guide/cli-service.md @@ -26,7 +26,7 @@ yarn serve Если у вас установлен [npx](https://github.com/npm/npx) (должен поставляться в комплекте с последней версией npm), то вы также можете запустить бинарник напрямую: ```bash -npx vue-cli-service serve +npx --no vue-cli-service serve ``` ::: tip Совет @@ -114,40 +114,40 @@ npx vue-cli-service serve Некоторые плагины CLI добавляют собственные команды в `vue-cli-service`. Например, `@vue/cli-plugin-eslint` внедряет команду `vue-cli-service lint`. Вы можете посмотреть весь список команд запустив: ```bash -npx vue-cli-service help +npx --no vue-cli-service help ``` Вы также можете узнать о доступных параметрах каждой команды с помощью: ```bash -npx vue-cli-service help [command] +npx --no vue-cli-service help [command] ``` -## Пропуск плагинов +## Исключение плагинов при запуске -Иногда при выполнении команды может понадобиться не использовать определённый плагин CLI. К примеру, для создания сборки приложения без плагина PWA. Такого можно добиться передав имя плагина в опцию `--skip-plugins`. +Можно исключить определённые плагины при запуске команды, передав имя плагина опцией `--skip-plugins`. ```bash -npx vue-cli-service build --skip-plugins pwa +npx --no vue-cli-service build --skip-plugins pwa ``` ::: tip СОВЕТ -Опция доступна для _любых_ команд `vue-cli-service`, включая пользовательские команды, добавленные другими плагинами. +Опция доступна для _любых_ команд `vue-cli-service`, в том числе и для пользовательских команд, добавленных другими плагинами. ::: Можно пропустить несколько подключаемых плагинов, передав их имена через запятую: ```bash -npx vue-cli-service build --skip-plugins pwa,apollo +npx --no vue-cli-service build --skip-plugins pwa,apollo ``` Имена плагинов разрешаются также, как и при установке, что подробнее описано [здесь](./plugins-and-presets.md#установка-пnагинов-в-существующий-проект) ```bash # все вызовы равнозначны -npx vue-cli-service build --skip-plugins pwa -npx vue-cli-service build --skip-plugins @vue/pwa -npx vue-cli-service build --skip-plugins @vue/cli-plugin-pwa +npx --no vue-cli-service build --skip-plugins pwa +npx --no vue-cli-service build --skip-plugins @vue/pwa +npx --no vue-cli-service build --skip-plugins @vue/cli-plugin-pwa ``` ## Кэширование и параллелизация diff --git a/docs/ru/guide/css.md b/docs/ru/guide/css.md index 5e38485a97..f4032ada72 100644 --- a/docs/ru/guide/css.md +++ b/docs/ru/guide/css.md @@ -21,6 +21,15 @@ npm install -D less-loader less npm install -D stylus-loader stylus ``` +:::tip Примечание при использовании webpack 4 +При использовании `webpack` версии 4, по умолчанию во Vue CLI 4, следует убедиться в совместимости используемых загрузчиков. В противном случае будут появляться ошибки о конфликтующих зависимостях. В таких случаях можно использовать более старую версию загрузчика, которая всё ещё совместима с `webpack` 4. + +```bash +# Sass +npm install -D sass-loader@^10 sass +``` +::: + Теперь вы можете импортировать соответствующие типы файлов, или использовать их синтаксис внутри файлов `*.vue` с помощью: ```vue diff --git a/docs/ru/guide/deployment.md b/docs/ru/guide/deployment.md index ca4d532324..632fb9e005 100644 --- a/docs/ru/guide/deployment.md +++ b/docs/ru/guide/deployment.md @@ -39,7 +39,7 @@ serve -s dist 1. Установите корректное значение `publicPath` в `vue.config.js`. - Если вы публикуете по адресу `https://.github.io/`, вы можете опустить `publicPath`, так как оно по умолчанию `"/"`. + Если публикуете по адресу `https://.github.io/` или на пользовательский домен, то можно опустить `publicPath`, так как оно по умолчанию `"/"`. Если вы публикуете по адресу `https://.github.io//`, (т.е. ваш репозиторий находится по адресу `https://github.com//`), установите `publicPath` в значение `"//"`. Например, если ваш репозиторий называется "my-project", то ваш `vue.config.js` будет выглядеть примерно так: @@ -163,15 +163,32 @@ module.exports = { Также посмотрите [vue-cli-plugin-netlify-lambda](https://github.com/netlify/vue-cli-plugin-netlify-lambda). -Для получения прямых хитов при использовании `режима history` во Vue Router, необходимо создавать файл `_redirects` в каталоге `/public` со следующим содержимым: +#### Использование режима history во Vue Router + +Для получения прямых хитов при использовании `режима history` во Vue Router, необходимо перенаправлять весь трафик в файл `/index.html`. + +> Подробнее можно изучить в [документации Netlify по перенаправлениям](https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps). + +##### Рекомендуемый метод + +Создать файл `netlify.toml` в корневом каталоге репозитория со следующим содержимым: + +```toml +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 +``` + +##### Альтернативный метод + +Создать файл `_redirects` в каталоге `/public` со следующим содержимым: ``` # Настройки Netlify для одностраничных приложений (SPA) /* /index.html 200 ``` -Подробнее можно изучить в [документации Netlify по перенаправлениям](https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps). - При использовании [@vue/cli-plugin-pwa](../core-plugins/pwa.md#vue-cli-plugin-pwa) убедитесь, что файл `_redirects` не кэшируется service worker. Для этого добавьте в `vue.config.js` следующее: @@ -194,11 +211,10 @@ module.exports = { [Render](https://render.com) предлагает [бесплатный хостинг статических сайтов](https://render.com/docs/static-sites) с полностью управляемым SSL, глобальным CDN и непрерывным автоматическим развёртыванием из GitHub. -1. Создайте новый Web Service в Render, и предоставьте доступ для GitHub-приложения Render в репозиторий. +1. Создайте новый Static Site в Render, и предоставьте доступ для GitHub-приложения Render в репозиторий. 2. При создании используйте следующие значения: - - **Окружение:** `Static Site` - **Команда сборки:** `npm run build` или `yarn build` - **Каталог публикации:** `dist` diff --git a/docs/ru/guide/index.md b/docs/ru/guide/index.md index 25a1e090fe..29f17b2805 100644 --- a/docs/ru/guide/index.md +++ b/docs/ru/guide/index.md @@ -4,10 +4,6 @@ sidebarDepth: 0 # Введение -::: warning Предупреждение -Эта документация для `@vue/cli`. Для старой версии `vue-cli`, см. [здесь](https://github.com/vuejs/vue-cli/tree/v2#vue-cli--). -::: - Vue CLI — полноценная система для быстрой разработки на Vue.js, предоставляющая: - Интерактивное создание проекта через `@vue/cli`. diff --git a/docs/ru/guide/installation.md b/docs/ru/guide/installation.md index 90150989dd..4e28152933 100644 --- a/docs/ru/guide/installation.md +++ b/docs/ru/guide/installation.md @@ -1,10 +1,5 @@ # Установка -::: danger Предупреждение о предыдущих версиях -Имя пакета изменилось с `vue-cli` на `@vue/cli`. -Если у вас установлена глобально предыдущая версия пакета `vue-cli` (1.x или 2.x), то необходимо сначала удалить её командой `npm uninstall vue-cli -g` или `yarn global remove vue-cli`. -::: - ::: tip Требования к версии Node Vue CLI 4.x требуется [Node.js](https://nodejs.org/) версии 8.9 или выше (рекомендуется v10+). Управлять несколькими версиями Node на машине можно через [n](https://github.com/tj/n), [nvm](https://github.com/creationix/nvm) или [nvm-windows](https://github.com/coreybutler/nvm-windows). ::: diff --git a/docs/ru/guide/mode-and-env.md b/docs/ru/guide/mode-and-env.md index 07cf7dfee1..2fbde776ba 100644 --- a/docs/ru/guide/mode-and-env.md +++ b/docs/ru/guide/mode-and-env.md @@ -54,7 +54,13 @@ VUE_APP_NOT_SECRET_CODE=some_value Обратите внимание, что только `NODE_ENV`, `BASE_URL` и переменные, именованные с префикса `VUE_APP_`, статически внедрятся в *клиентскую сборку* с помощью `webpack.DefinePlugin`. Это сделано во избежание случайного обнародования закрытого ключа на машине, которая может иметь такое же имя. -Подробнее о правилах парсинга env можно узнать [в документации `dotenv`](https://github.com/motdotla/dotenv#rules). Мы также используем [dotenv-expand](https://github.com/motdotla/dotenv-expand) для переменных расширения (доступно в Vue CLI 3.5+). +Подробнее о правилах парсинга env [в документации `dotenv`](https://github.com/motdotla/dotenv#rules). Можно также использовать [dotenv-expand](https://github.com/motdotla/dotenv-expand) для переменных расширения (доступно с версии Vue CLI 3.5+). Например: + +```bash +FOO=foo +BAR=bar +CONCAT=$FOO$BAR # CONCAT=foobar +``` Загруженные переменные станут доступны всем командам `vue-cli-service`, плагинам и зависимостям. @@ -78,7 +84,7 @@ VUE_APP_TITLE=My App ``` NODE_ENV=production -VUE_APP_TITLE=My App (staging) +VUE_APP_TITLE=My Staging App ``` - `vue-cli-service build` собирает приложение для production, загружает `.env`, `.env.production` и `.env.production.local` если они существуют; diff --git a/docs/zh/config/index.md b/docs/zh/config/index.md index 873b3a0465..08529ad8d5 100644 --- a/docs/zh/config/index.md +++ b/docs/zh/config/index.md @@ -22,6 +22,10 @@ sidebar: auto ``` js // vue.config.js + +/** + * @type {import('@vue/cli-service').ProjectOptions} + */ module.exports = { // 选项... } diff --git a/docs/zh/dev-guide/plugin-dev.md b/docs/zh/dev-guide/plugin-dev.md index 7b462fcff7..8c71d9b45b 100644 --- a/docs/zh/dev-guide/plugin-dev.md +++ b/docs/zh/dev-guide/plugin-dev.md @@ -152,7 +152,7 @@ export default { extend: '@vue/cli-service/generator/template/src/App.vue' replace: - !!js/regexp /Welcome to Your Vue\.js App/ - - !!js/regexp /