Skip to content

Commit 285c4d8

Browse files
authored
feat(docs): add usage with Quasar CLI (#773)
* feat(docs): add usage with Quasar CLI * feat(docs): small tweaks to Quasar CLI usage * feat(docs): further tweaks for Quasar CLI usage
1 parent 25dce2b commit 285c4d8

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

docs/guide/advanced/optimization.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ module.exports = {
8686
}
8787
```
8888

89+
### Quasar CLI
90+
91+
No need to do anything. [Quasar CLI](https://quasar.dev) takes care of the optimizations for you.
8992

9093
## Reduce bundle size with feature build flags
9194

@@ -104,6 +107,7 @@ The build will work without configuring these flags, however it is **strongly re
104107
- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
105108
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
106109
- Vite: configured by default, but can be overwritten using the [`define` option](https://github.com/vitejs/vite/blob/a4133c073e640b17276b2de6e91a6857bdf382e1/src/node/config.ts#L72-L76)
110+
- Quasar CLI: configured by default, but can be overwritten using quasar.conf.js > build > [env option](https://quasar.dev/quasar-cli/handling-process-env#adding-to-process-env)
107111

108112
:::tip NOTE
109113
If you are using Vite, you can do the same thing by specifying the option in the [plugin provided officially](https://github.com/intlify/vite-plugin-vue-i18n).

docs/guide/advanced/sfc.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,36 @@ module.exports = {
529529
}
530530
}
531531
```
532+
533+
## Quasar CLI
534+
535+
If we want to add support to the `<i18n>` tag inside a single file component in a [Quasar CLI](https://quasar.dev) project then we need to modify the existing configuration.
536+
537+
In order to do that we need to edit `quasar.conf.js` at the root of our project:
538+
539+
```js
540+
build: {
541+
chainWebpack: chain => {
542+
chain.module
543+
.rule('i18n-resource')
544+
.test(/\.(json5?|ya?ml)$/)
545+
.include.add(path.resolve(__dirname, './src/i18n'))
546+
.end()
547+
.type('javascript/auto')
548+
.use('i18n-resource')
549+
.loader('@intlify/vue-i18n-loader')
550+
chain.module
551+
.rule('i18n')
552+
.resourceQuery(/blockType=i18n/)
553+
.type('javascript/auto')
554+
.use('i18n')
555+
.loader('@intlify/vue-i18n-loader')
556+
}
557+
}
558+
```
559+
560+
We also need to make sure that we've installed `@intlify/vue-i18n-loader`:
561+
562+
```sh
563+
npm i --save-dev @intlify/vue-i18n-loader
564+
```

docs/ja/guide/advanced/optimization.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ module.exports = {
8686
}
8787
```
8888

89+
### Quasar CLI
90+
91+
No need to do anything. [Quasar CLI](https://quasar.dev) takes care of the optimizations for you.
8992

9093
## Reduce bundle size with feature build flags
9194

@@ -100,6 +103,7 @@ The build will work without configuring these flags, however it is **strongly re
100103
- webpack: use [DefinePlugin](https://webpack.js.org/plugins/define-plugin/)
101104
- Rollup: use [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
102105
- Vite: configured by default, but can be overwritten using the [`define` option](https://github.com/vitejs/vite/blob/a4133c073e640b17276b2de6e91a6857bdf382e1/src/node/config.ts#L72-L76)
106+
- Quasar CLI: configured by default, but can be overwritten using quasar.conf.js > build > [env option](https://quasar.dev/quasar-cli/handling-process-env#adding-to-process-env)
103107

104108
:::tip NOTE
105109
If you are using Vite, you can do the same thing by specifying the option in the [plugin provided officially](https://github.com/intlify/vite-plugin-vue-i18n).

docs/ja/guide/advanced/sfc.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,36 @@ module.exports = {
530530
}
531531
}
532532
```
533+
534+
## Quasar CLI
535+
536+
If we want to add support to the `<i18n>` tag inside a single file component in a [Quasar CLI](https://quasar.dev) project then we need to modify the existing configuration.
537+
538+
In order to do that we need to edit `quasar.conf.js` at the root of our project:
539+
540+
```js
541+
build: {
542+
chainWebpack: chain => {
543+
chain.module
544+
.rule('i18n-resource')
545+
.test(/\.(json5?|ya?ml)$/)
546+
.include.add(path.resolve(__dirname, './src/i18n'))
547+
.end()
548+
.type('javascript/auto')
549+
.use('i18n-resource')
550+
.loader('@intlify/vue-i18n-loader')
551+
chain.module
552+
.rule('i18n')
553+
.resourceQuery(/blockType=i18n/)
554+
.type('javascript/auto')
555+
.use('i18n')
556+
.loader('@intlify/vue-i18n-loader')
557+
}
558+
}
559+
```
560+
561+
We also need to make sure that we've installed `@intlify/vue-i18n-loader`:
562+
563+
```sh
564+
npm i --save-dev @intlify/vue-i18n-loader
565+
```

0 commit comments

Comments
 (0)