Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

feat: update docs with contenthash defaults #1710

Merged
merged 5 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions de/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,22 @@ Using [`extract-css-chunks-webpack-plugin`](https://github.com/faceyspacey/extra

```js
{
css: 'common.[contenthash].css',
manifest: 'manifest.[hash].js',
vendor: 'common.[chunkhash].js',
app: 'app.[chunkhash].js',
chunk: '[name].[chunkhash].js'
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

This example changes fancy chunk names to numerical ids (`nuxt.config.js`):

```js
module.exports = {
export default {
build: {
filenames: {
chunk: '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions en/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,24 +249,24 @@ export default {
- Type: `Object`
- Default:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
}
```
```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

This example changes fancy chunk names to numerical ids (`nuxt.config.js`):

```js
export default {
build: {
filenames: {
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
28 changes: 16 additions & 12 deletions es/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,26 @@ If you want to see more about our default webpack configuration, take a look at

> Customize bundle filenames

Default:
```js
{
manifest: 'manifest.[hash].js',
vendor: 'vendor.bundle.[hash].js',
app: 'nuxt.bundle.[chunkhash].js'
}
```
- Default:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

This example changes fancy chunk names to numerical ids (`nuxt.config.js`):

Example (`nuxt.config.js`):
```js
module.exports = {
export default {
build: {
filenames: {
vendor: 'vendor.[hash].js',
app: 'app.[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
23 changes: 12 additions & 11 deletions id/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,24 @@ Menggunakan [`extract-css-chunks-webpack-plugin`](https://github.com/faceyspacey

- Default:

```js
{
css: 'common.[contenthash].css',
manifest: 'manifest.[hash].js',
vendor: 'common.[chunkhash].js',
app: 'app.[chunkhash].js',
chunk: '[name].[chunkhash].js'
}
```
```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

Contoh berikut ini mengubah nama-nama chunk menjadi id numerik (`nuxt.config.js`):

```js
module.exports = {
export default {
build: {
filenames: {
chunk: '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions ja/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,24 @@ export default {
- 型: `Object`
- デフォルト:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
}
```
```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

この例ではチャンク名を数値の ID に変更します(`nuxt.config.js`):

```js
export default {
build: {
filenames: {
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
26 changes: 15 additions & 11 deletions ko/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,26 @@ module.exports = {

> 사용자가 정의한 번들 파일이름

기본값:
```js
{
manifest: 'manifest.[hash].js',
vendor: 'vendor.bundle.[hash].js',
app: 'nuxt.bundle.[chunkhash].js'
}
```
- 기본값:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

예제 (`nuxt.config.js`):

```js
module.exports = {
export default {
build: {
filenames: {
vendor: 'vendor.[hash].js',
app: 'app.[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
26 changes: 14 additions & 12 deletions pt-BR/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,26 @@ CSS inside async components will remain inlined as JavaScript strings and handle

> Customize bundle filenames

Default:
```js
{
css: 'common.[contenthash].css',
manifest: 'manifest.[hash].js',
vendor: 'common.[chunkhash].js',
app: 'app.[chunkhash].js',
chunk: '[name].[chunkhash].js'
}
```
- Default:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

This example changes fancy chunk names to numerical ids (`nuxt.config.js`):

```js
module.exports = {
export default {
build: {
filenames: {
chunk: '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
Expand Down
26 changes: 14 additions & 12 deletions zh/api/configuration-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,29 +188,31 @@ export default {

> 自定义打包文件名

默认值:
```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[chunkhash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
}
```
- 默认值:

```js
{
app: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[contenthash].js',
css: ({ isDev }) => isDev ? '[name].css' : '[contenthash].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[contenthash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[contenthash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[contenthash:7].[ext]'
}
```

此示例将 chunk 名称更改为数字id (`nuxt.config.js`):

```js
export default {
build: {
filenames: {
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[chunkhash].js'
chunk: ({ isDev }) => isDev ? '[name].js' : '[id].[contenthash].js'
}
}
}
```

要更多了解使用,可以移步[webpack documentation](https://webpack.js.org/guides/code-splitting-libraries/)

## friendlyErrors
Expand Down