vbv/client/vite.config.ts

50 lines
1.3 KiB
TypeScript

import {fileURLToPath, URL} from 'url'
import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
// import vueI18n from '@intlify/vite-plugin-vue-i18n'
import alias from '@rollup/plugin-alias'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return {
plugins: [
vue({
template: {
compilerOptions: {
// treat all tags which start with '<it-' as custom elements
isCustomElement: (tag) => tag.startsWith('it-'),
},
},
}),
// vueI18n({
// include: path.resolve(__dirname, './locales/**')
// }),
// won't work in vite's resolve.alias, so we'll make the alias here
alias({
// TODO: why is that used?
// entries: [
// {
// find: 'vue-i18n',
// replacement: path.resolve(__dirname, './node_modules/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js')
// }
// ]
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
assetsDir: 'static/vue',
},
test: {
globals: true,
environment: 'happy-dom',
},
}
})