/*
 * @Author: Kane
 * @Date: 2023-02-23 00:15:24
 * @LastEditors: Kane
 * @LastEditTime: 2023-02-23 00:43:33
 * @FilePath: /it-console-toVite/vite.config.js
 * @Description: 
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
import { defineConfig } from 'vite';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import ViteRequireContext from '@originjs/vite-plugin-require-context';
import envCompatible from 'vite-plugin-env-compatible';
import { createHtmlPlugin } from 'vite-plugin-html';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: [
      {
        find: /^~/,
        replacement: '',
      },
      {
        find: '@',
        replacement: path.resolve(__dirname, 'src'),
      },
    ],
    extensions: [
      '.mjs',
      '.js',
      '.ts',
      '.jsx',
      '.tsx',
      '.json',
      '.vue',
    ],
  },
  plugins: [
    vue(),
    vueJsx(),
    ViteRequireContext(),
    viteCommonjs(),
    envCompatible(),
    createHtmlPlugin({
      inject: {
        data: {
          title: 'CPIC-IT-Console',
        },
      },
    }),
  ],
  base: './',
  server: {
    strictPort: false,
    port: 8001,
    host: 'localhost',
    open: true,
  },
  build: {
    outDir: 'dist',
  },
});
