47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import path from 'path';
|
|
// import react from '@vitejs/plugin-react';
|
|
import tailwindcss from 'tailwindcss';
|
|
import autoprefixer from 'autoprefixer';
|
|
import nesting from 'tailwindcss/nesting';
|
|
|
|
export default defineConfig({
|
|
root: '.',
|
|
// plugins: [react()],
|
|
css: {
|
|
postcss: {
|
|
// @ts-ignore
|
|
plugins: [nesting, tailwindcss, autoprefixer],
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
// react: './utils/h.ts', // 将 react 替换为自定义的 JSX 库
|
|
// 'react-dom': './utils/h.ts', // 将 react-dom 替换为自定义的 JSX 库
|
|
// 上到下,上面的先被匹配
|
|
// '@kevisual/store/config': 'https://kevisual.xiongxiao.me/system/lib/web-config.js', // 将本地路径替换为远程 URL
|
|
// '@kevisual/store/context': 'https://kevisual.xiongxiao.me/system/lib/web-context.js', // 将本地路径替换为远程 URL
|
|
// '@kevisual/store': 'https://kevisual.xiongxiao.me/system/lib/store.js', // 将本地路径替换为远程 URL
|
|
// '@kevisual/router/browser': 'https://kevisual.xiongxiao.me/system/lib/router-browser.js', // 将本地路径替换为远程 URL
|
|
},
|
|
},
|
|
build: {
|
|
minify: false,
|
|
outDir: './dist',
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom'],
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ['react', 'react-dom'], // 排除 react 和 react-dom 以避免打包
|
|
},
|
|
esbuild: {
|
|
jsxFactory: 'h',
|
|
jsxFragment: 'Fragment',
|
|
},
|
|
server: {
|
|
port: 5002,
|
|
},
|
|
});
|