Files
geovisio-website/vite.config.js
2024-03-05 13:30:13 +01:00

63 lines
1.7 KiB
JavaScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import eslintPlugin from 'vite-plugin-eslint'
import { createHtmlPlugin } from 'vite-plugin-html'
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
return defineConfig({
server: {
host: true,
port: 5173,
strictPort: true,
hmr: {
clientPort: 5173,
overlay: false
}
},
base: '/',
plugins: [
vue(),
eslintPlugin(),
createHtmlPlugin({
minify: true,
/**
* After writing entry here, you will not need to add script tags in `index.html`, the original tags need to be deleted
* @default src/main.ts
*/
entry: 'src/main.ts',
/**
* If you want to store `index.html` in the specified folder, you can modify it, otherwise no configuration is required
* @default index.html
*/
template: '/index.html',
/**
* Data that needs to be injected into the index.html ejs template
*/
inject: {
data: {
instanceName: process.env.VITE_INSTANCE_NAME,
frontUrl: process.env.VITE_FRONT_URL
}
}
})
],
css: {
preprocessorOptions: {
scss: {
additionalData:
'@import "@/assets/font-size.scss"; @import "@/assets/rem-calc.scss";'
}
}
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
}
}
})
}