@@ -123,28 +123,29 @@ npm i --save-dev @intlify/rollup-plugin-vue-i18n
123123Rollup config for example:
124124
125125``` js
126- import vue from ' rollup-plugin-vue'
127- import replace from ' @ rollup/ plugin-replace '
126+ import VuePlugin from ' rollup-plugin-vue'
127+ import VueI18nPlugin from ' rollup- plugin-vue-i18n '
128128import resolve from ' @rollup/plugin-node-resolve'
129129import commonjs from ' @rollup/plugin-commonjs'
130- import i18n from ' @intlify/rollup-plugin-vue-i18n'
131130import path from ' path'
132131
133132export default [
134133 {
135- input: path .resolve (__dirname , ` ./path/to/main.js` ),
134+ input: path .resolve (__dirname , ` ./path/to/src/ main.js` ),
136135 output: {
137136 file: path .resolve (__dirname , ` ./path/to/dist/index.js` ),
138137 format: ' cjs'
139138 },
140139 plugins: [
141- commonjs (),
142- resolve (),
143- replace ({
144- ' process.env.NODE_ENV' : JSON .stringify (' production' )
140+ // set `customBlocks` opton to `rollup-plugin-vue`
141+ VuePlugin ({ customBlocks: [' i18n' ] }),
142+ // set `rollup-plugin-vue-i18n` after **`rollup-plugin-vue`**
143+ VueI18nPlugin ({
144+ // `include` option for i18n resources bundling
145+ include: path .resolve (__dirname , ` ./path/to/src/locales/**` )
145146 }),
146- i18n (),
147- vue ({ customBlocks : [ ' i18n ' ] } )
147+ resolve (),
148+ commonjs ( )
148149 ]
149150 }
150151]
@@ -171,13 +172,17 @@ npm i --save-dev @intlify/vite-plugin-vue-i18n
171172vite config for example:
172173
173174``` ts
175+ import path from ' path'
176+ import { pluginI18n } from ' @intlify/vite-plugin-vue-i18n'
177+
174178import type { UserConfig } from ' vite'
175- import i18n from ' @intlify/vite-plugin-vue-i18n'
176179
177180const config: UserConfig = {
178- vueCustomBlockTransforms: {
179- i18n
180- }
181+ plugins: [
182+ pluginI18n ({
183+ include: path .resolve (__dirname , ' ./path/to/src/locales/**' )
184+ })
185+ ]
181186}
182187
183188export default config
0 commit comments