123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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"
- ? "//infishwaibao.oss-cn-chengdu.aliyuncs.com/xihuadesign/"
- : "./",
- build: {
- rollupOptions: {
- input: {
- index: resolve(__dirname, "./index.html"),
- admin: resolve(__dirname, "./admin.html"),
- },
- },
- },
- server: {
- host: "0.0.0.0",
- port: 8888,
- open: false,
- },
- 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,
- modifyVars: {
- "primary-color": "#41969c",
- },
- },
- },
- },
- resolve: {
- alias: {
- "@": fileURLToPath(new URL("./src", import.meta.url)),
- },
- },
- });
|