1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import { defineConfig, normalizePath } from "vite";
- import { fileURLToPath, URL } from "node:url";
- import vue from "@vitejs/plugin-vue";
- import vueJsx from "@vitejs/plugin-vue-jsx";
- import linaria from "@linaria/rollup";
- import css from "rollup-plugin-css-only";
- import WindiCSS from "vite-plugin-windicss";
- import Components from "unplugin-vue-components/vite";
- import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
- import { resolve } from "path";
- // https://vitejs.dev/config/
- export default defineConfig({
- base: process.env.NODE_ENV == "production" ? "./" : "./",
- build: {
- rollupOptions: {
- input: {
- index: resolve(__dirname, "./index.html"),
- admin: resolve(__dirname, "./admin.html"),
- },
- },
- },
- plugins: [
- WindiCSS(),
- linaria({
- include: ["**/*.{ts,tsx}"],
- sourceMap: process.env.NODE_ENV !== "production",
- babelOptions: {
- presets: ["@babel/preset-typescript"],
- },
- }),
- // css({
- // output: (
- // styles: string,
- // styleNodes: Record<string, string>,
- // bundle: any
- // ) => {
- // console.log(bundle);
- // return "style.css";
- // },
- // }),
- Components({
- resolvers: [
- AntDesignVueResolver({
- // importLess: true
- }),
- ],
- }),
- vue(),
- vueJsx(),
- ],
- esbuild: {
- include: ["./src/**/*.tsx"],
- jsxInject: `import { getImageUrl } from '@/utils'`,
- },
- css: {
- preprocessorOptions: {
- less: {
- javascriptEnabled: true,
- },
- },
- },
- resolve: {
- alias: {
- "@": fileURLToPath(new URL("./src", import.meta.url)),
- },
- },
- });
|