Skip to content

Commit 357c99a

Browse files
committed
chore: merge branch 'master' into dev
2 parents 81e17e8 + f83c441 commit 357c99a

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

docs/guide/build-targets.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ A lib build outputs:
5050

5151
- `dist/myLib.css`: Extracted CSS file (can be forced into inlined by setting `css: { extract: false }` in `vue.config.js`)
5252

53+
::: warning
54+
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.
55+
:::
56+
5357
### Vue vs. JS/TS Entry Files
5458

5559
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:
148152

149153
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)
150154

151-
So to use vuex in web component target, you need to initialize the store in `App.vue`:
155+
So to use vuex in web component target, you need to initialize the store in `App.vue`:
152156

153157
``` js
154158
import store from './store'

docs/guide/cli-service.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The `vue-cli-service serve` command starts a dev server (based on [webpack-dev-s
6363

6464
In addition to the command line flags, you can also configure the dev server using the [devServer](../config/#devserver) field in `vue.config.js`.
6565

66-
`[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.
66+
`[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).
6767

6868
## vue-cli-service build
6969

@@ -167,6 +167,12 @@ When installed, `@vue/cli-service` also installs [yorkie](https://github.com/yyx
167167
{
168168
"gitHooks": {
169169
"pre-commit": "lint-staged"
170+
},
171+
"lint-staged": {
172+
"*.{js,vue}": [
173+
"vue-cli-service lint",
174+
"git add"
175+
]
170176
}
171177
}
172178
```

docs/guide/css.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ module.exports = {
112112
// For Vue CLI v3 users, please refer to css-loader v1 documentations
113113
// https://github.com/webpack-contrib/css-loader/tree/v1.0.1
114114
modules: {
115-
localIdentName: '[name]-[hash]',
116-
localsConvention: 'camelCaseOnly'
117-
}
115+
localIdentName: '[name]-[hash]'
116+
},
117+
localsConvention: 'camelCaseOnly'
118118
}
119119
}
120120
}

docs/guide/deployment.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,24 @@ pages: # the job must be named pages
130130
- npm run build
131131
- mv public public-vue # GitLab Pages hooks on the public folder
132132
- mv dist public # rename the dist folder (result of npm run build)
133+
# optionally, you can activate gzip support wih the following line:
134+
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
133135
artifacts:
134136
paths:
135137
- public # artifact path must be /public for GitLab Pages to pick it up
136138
only:
137139
- master
138140
```
139141

140-
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:
142+
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):
143+
141144

142145
```javascript
143146
// vue.config.js file to be place in the root of your repository
144-
// make sure you update `yourProjectName` with the name of your GitLab project
145147
146148
module.exports = {
147149
publicPath: process.env.NODE_ENV === 'production'
148-
? '/yourProjectName/'
150+
? '/' + process.env.CI_PROJECT_NAME + '/'
149151
: '/'
150152
}
151153
```

docs/migrating-from-v3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ It now requires `eslint`, `eslint-plugin-prettier` and `prettier` as peer depend
224224
For older projects, if you encountered issues like `Cannot find module: eslint-plugin-prettier`, please run the following command to fix it:
225225

226226
```sh
227-
npm install --sav-dev eslint@5 @vue/eslint-config-prettier@5 eslint-plugin-prettier prettier
227+
npm install --save-dev eslint@5 @vue/eslint-config-prettier@5 eslint-plugin-prettier prettier
228228
```
229229

230230
------

docs/zh/guide/browser-compatibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
如果有依赖需要 polyfill,你有几种选择:
1818

19-
1. **如果该依赖基于一个目标环境不支持的 ES 版本撰写:** 将其添加到 `vue.config.js` 中的 [`transpileDependencies`](../config/#transpiledependencies) 选项。这会为该依赖同时开启语法语法转换和根据使用情况检测 polyfill。
19+
1. **如果该依赖基于一个目标环境不支持的 ES 版本撰写:** 将其添加到 `vue.config.js` 中的 [`transpileDependencies`](../config/#transpiledependencies) 选项。这会为该依赖同时开启语法转换和根据使用情况检测 polyfill。
2020

2121
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 是非常普遍的。**
2222

docs/zh/guide/build-targets.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ dist/myLib.css 0.33 kb 0.23 kb
5454

5555
- `dist/myLib.css`:提取出来的 CSS 文件 (可以通过在 `vue.config.js` 中设置 `css: { extract: false }` 强制内联)
5656

57+
::: warning 警告
58+
如果你在开发一个库或多项目仓库 (monorepo),请注意导入 CSS **是具有副作用的**。请确保在 `package.json`**移除** `"sideEffects": false`,否则 CSS 代码块会在生产环境构建时被 webpack 丢掉。
59+
:::
60+
5761
### Vue vs. JS/TS 入口文件
5862

5963
当使用一个 `.vue` 文件作为入口时,你的库会直接暴露这个 Vue 组件本身,因为组件始终是默认导出的内容。

0 commit comments

Comments
 (0)