Configuration for Vitejs

Split translations into separate files and optimize bundle size in Vite.js


Configuration

To split translations into separate files and optimize bundle size in Vite.js, follow these steps:

Update Vite Configuration for Vue

In the vite.config.js file, import the necessary packages and configure Vite with the viteTranslationPlugin:

import { viteTranslationPlugin } from '@resourge/vue-translations/viteTranslationPlugin';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    viteTranslationPlugin()
  ]
});

Update Vite Configuration for React

In the vite.config.js file, import the necessary packages and configure Vite with the viteTranslationPlugin:

import { viteTranslationPlugin } from '@resourge/react-translations/viteTranslationPlugin';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    viteTranslationPlugin()
  ]
});
💡

The translations will be split into separate files and the bundle size will be optimized.