From ae111393f2e14504de78613f9e85431b3f8af748 Mon Sep 17 00:00:00 2001 From: "Sean G. Wright" Date: Fri, 25 Oct 2019 04:04:27 -0400 Subject: [PATCH 1/7] Update migrating-from-v3 README typo (#4746) Changed `--sav-dev` to `--save-dev` --- docs/migrating-from-v3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migrating-from-v3/README.md b/docs/migrating-from-v3/README.md index e69227c3d2..df7a64ca48 100644 --- a/docs/migrating-from-v3/README.md +++ b/docs/migrating-from-v3/README.md @@ -224,7 +224,7 @@ It now requires `eslint`, `eslint-plugin-prettier` and `prettier` as peer depend For older projects, if you encountered issues like `Cannot find module: eslint-plugin-prettier`, please run the following command to fix it: ```sh -npm install --sav-dev eslint@5 @vue/eslint-config-prettier@5 eslint-plugin-prettier prettier +npm install --save-dev eslint@5 @vue/eslint-config-prettier@5 eslint-plugin-prettier prettier ``` ------ From 6347fd26600d66cdd03eec5027c41e7b76d88f41 Mon Sep 17 00:00:00 2001 From: arnaudvalle Date: Sat, 26 Oct 2019 09:54:30 +0200 Subject: [PATCH 2/7] docs: specify default entryFile value for serve command (#4758) --- docs/guide/cli-service.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/cli-service.md b/docs/guide/cli-service.md index 1a4ba4560b..e0502a00e7 100644 --- a/docs/guide/cli-service.md +++ b/docs/guide/cli-service.md @@ -63,7 +63,7 @@ The `vue-cli-service serve` command starts a dev server (based on [webpack-dev-s In addition to the command line flags, you can also configure the dev server using the [devServer](../config/#devserver) field in `vue.config.js`. -`[entry]` in the CLI command is defined as *the entry file*, not *an additional entry file*. If you overwrite the entry in the CLI, then the entries from `config.pages` are no longer considered, which may cause an error. +`[entry]` in the CLI command is defined as *the entry file*, not *an additional entry file*. If you overwrite the entry in the CLI, then the entries from `config.pages` are no longer considered, which may cause an error. Defaults to [entryFile](../dev-guide/generator-api.html#entryfile). ## vue-cli-service build From 77384eced81180b4c39d377d1bfdeeacf1886670 Mon Sep 17 00:00:00 2001 From: Yoshiaki Itakura Date: Wed, 6 Nov 2019 23:14:28 +0900 Subject: [PATCH 3/7] fix docs `css.loaderOptions.css.localsConvention` (#4803) Moved 'localsConvention' to the same level as 'modules'. --- docs/guide/css.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/css.md b/docs/guide/css.md index aac1986dbf..638633c34b 100644 --- a/docs/guide/css.md +++ b/docs/guide/css.md @@ -112,9 +112,9 @@ module.exports = { // For Vue CLI v3 users, please refer to css-loader v1 documentations // https://github.com/webpack-contrib/css-loader/tree/v1.0.1 modules: { - localIdentName: '[name]-[hash]', - localsConvention: 'camelCaseOnly' - } + localIdentName: '[name]-[hash]' + }, + localsConvention: 'camelCaseOnly' } } } From d4bd9c644fbb563f6c9750143ac70c94a95a2b45 Mon Sep 17 00:00:00 2001 From: gregoiredx Date: Thu, 7 Nov 2019 06:17:48 +0100 Subject: [PATCH 4/7] use gitlab CI env variable for project name (#4716) * use gitlab CI env variable for project name * add explanation on CI_PROJECT_NAME env var * docs: gzip support in GitLab Pages --- docs/guide/deployment.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index cbf32e1efe..be568a1a04 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -130,6 +130,8 @@ pages: # the job must be named pages - npm run build - mv public public-vue # GitLab Pages hooks on the public folder - mv dist public # rename the dist folder (result of npm run build) + # optionally, you can activate gzip support wih the following line: + - find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \; artifacts: paths: - public # artifact path must be /public for GitLab Pages to pick it up @@ -137,15 +139,15 @@ pages: # the job must be named pages - master ``` -Typically, your static website will be hosted on https://yourUserName.gitlab.io/yourProjectName, so you will also want to create an initial `vue.config.js` file to [update the `BASE_URL`](https://github.com/vuejs/vue-cli/tree/dev/docs/config#baseurl) value to match: +Typically, your static website will be hosted on https://yourUserName.gitlab.io/yourProjectName, so you will also want to create an initial `vue.config.js` file to [update the `BASE_URL`](https://github.com/vuejs/vue-cli/tree/dev/docs/config#baseurl) value to match your project name (the [`CI_PROJECT_NAME` environment variable](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) contains this value): + ```javascript // vue.config.js file to be place in the root of your repository -// make sure you update `yourProjectName` with the name of your GitLab project module.exports = { publicPath: process.env.NODE_ENV === 'production' - ? '/yourProjectName/' + ? '/' + process.env.CI_PROJECT_NAME + '/' : '/' } ``` From f9291581e844893e51006b7db883e8d13303dc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E7=BF=B0=E5=BC=9F?= <18233566286@163.com> Date: Mon, 11 Nov 2019 19:16:21 +0800 Subject: [PATCH 5/7] docs(zh): Update browser-compatibility.md (#4831) --- docs/zh/guide/browser-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/guide/browser-compatibility.md b/docs/zh/guide/browser-compatibility.md index b5a9e848cb..098297ca53 100644 --- a/docs/zh/guide/browser-compatibility.md +++ b/docs/zh/guide/browser-compatibility.md @@ -16,7 +16,7 @@ 如果有依赖需要 polyfill,你有几种选择: -1. **如果该依赖基于一个目标环境不支持的 ES 版本撰写:** 将其添加到 `vue.config.js` 中的 [`transpileDependencies`](../config/#transpiledependencies) 选项。这会为该依赖同时开启语法语法转换和根据使用情况检测 polyfill。 +1. **如果该依赖基于一个目标环境不支持的 ES 版本撰写:** 将其添加到 `vue.config.js` 中的 [`transpileDependencies`](../config/#transpiledependencies) 选项。这会为该依赖同时开启语法转换和根据使用情况检测 polyfill。 2. **如果该依赖交付了 ES5 代码并显式地列出了需要的 polyfill:** 你可以使用 `@vue/babel-preset-app` 的 [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) 选项预包含所需要的 polyfill。**注意 `es6.promise` 将被默认包含,因为现在的库依赖 Promise 是非常普遍的。** From e46ac207846cdc806d03881828c3a08f8f2162fe Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 21 Nov 2019 16:33:02 +0800 Subject: [PATCH 6/7] docs: add warnings on css sideEffects (#4836) These warnings are originally stated in the vue-loader documentation, but the CLI documentation perhaps have more visibility. Fixes #4832 --- docs/guide/build-targets.md | 6 +++++- docs/zh/guide/build-targets.md | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/guide/build-targets.md b/docs/guide/build-targets.md index 064c19b7f2..6414814825 100644 --- a/docs/guide/build-targets.md +++ b/docs/guide/build-targets.md @@ -50,6 +50,10 @@ A lib build outputs: - `dist/myLib.css`: Extracted CSS file (can be forced into inlined by setting `css: { extract: false }` in `vue.config.js`) +::: warning +If you are developing a library or in a monorepo, please be aware that CSS imports **are side effects**. Make sure to **remove** `"sideEffects": false` in the `package.json`, otherwise CSS chunks will be dropped by webpack in production builds. +::: + ### Vue vs. JS/TS Entry Files When using a `.vue` file as entry, your library will directly expose the Vue component itself, because the component is always the default export. @@ -148,7 +152,7 @@ Now on the page, the user only needs to include Vue and the entry file: When building a [Webcomponent](#web-component) or [Library](#library), the entry point is not `main.js`, but an `entry-wc.js` file, generated here: [https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js) -So to use vuex in web component target, you need to initialize the store in `App.vue`: +So to use vuex in web component target, you need to initialize the store in `App.vue`: ``` js import store from './store' diff --git a/docs/zh/guide/build-targets.md b/docs/zh/guide/build-targets.md index ad191878fc..a0cd4d795c 100644 --- a/docs/zh/guide/build-targets.md +++ b/docs/zh/guide/build-targets.md @@ -54,6 +54,10 @@ dist/myLib.css 0.33 kb 0.23 kb - `dist/myLib.css`:提取出来的 CSS 文件 (可以通过在 `vue.config.js` 中设置 `css: { extract: false }` 强制内联) +::: warning 警告 +如果你在开发一个库或多项目仓库 (monorepo),请注意导入 CSS **是具有副作用的**。请确保在 `package.json` 中**移除** `"sideEffects": false`,否则 CSS 代码块会在生产环境构建时被 webpack 丢掉。 +::: + ### Vue vs. JS/TS 入口文件 当使用一个 `.vue` 文件作为入口时,你的库会直接暴露这个 Vue 组件本身,因为组件始终是默认导出的内容。 From f83c44113f993ea1a92ca846109ddc6ef38cd7aa Mon Sep 17 00:00:00 2001 From: "Jose G. Alfonso" Date: Thu, 21 Nov 2019 00:33:38 -0800 Subject: [PATCH 7/7] Update doc section on Git Hooks (#4820) Added complete required entries for lint-staged to work --- docs/guide/cli-service.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/guide/cli-service.md b/docs/guide/cli-service.md index e0502a00e7..cce0298632 100644 --- a/docs/guide/cli-service.md +++ b/docs/guide/cli-service.md @@ -167,6 +167,12 @@ When installed, `@vue/cli-service` also installs [yorkie](https://github.com/yyx { "gitHooks": { "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.{js,vue}": [ + "vue-cli-service lint", + "git add" + ] } } ```