This is an example of back-end integration.
The following are examples of two cases:
- i18n JIT compilation
- i18n resource pre-compilation
vite.config.ts
: define the plugin that is simulated as the back-end for development modedb
: simulate the loading of resources from the databasescripts/generate.ts
: pre-compile the i18n resourcesscripts/server.ts
: simulate production serversrc/locales.ts
: define the i18n resources load function
npm run dev
npm run serve # start server
npm run preview # start preview
npm run generate # i18n resources pre-compilation
npm run preview # start preview
NOTE: You need to enable comment out codes on
src/locales.ts