We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd80760 commit c98a157Copy full SHA for c98a157
packages/plugin-vue/README.md
@@ -11,6 +11,32 @@ export default {
11
}
12
```
13
14
+## Example for transforming custom blocks
15
+
16
+```ts
17
+// vite.config.js
18
+import vue from '@vitejs/plugin-vue'
19
20
+const vueI18nPlugin = {
21
+ name: 'vue-i18n',
22
+ transform(code, id) {
23
+ if (!/vue&type=i18n/.test(id)) {
24
+ return
25
+ }
26
+ if (/\.ya?ml$/.test(id)) {
27
+ code = JSON.stringify(require('js-yaml').safeLoad(code.trim()))
28
29
+ return `export default Comp => {
30
+ Comp.i18n = ${code}
31
+ }`
32
33
+}
34
35
+export default {
36
+ plugins: [vue(), vueI18nPlugin]
37
38
+```
39
40
## License
41
42
MIT
0 commit comments