这个项目作为聊天界面
- npm install vite-plugin-node-polyfills --save-dev
- vite.config.js
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default defineConfig({
plugins: [
nodePolyfills({
// 明确指定需要 polyfill 的模块
include: ['buffer'],
// 配置 buffer 全局变量
buffer: {
global: true,
},
}),
],
});npm installnpm run servenpm run buildnpm run build:stagingnpm run previewnpm run preview:staging- This project exposes environment variables on
import.meta.envobject. - Different modes (development/staging/production) correspond to different environment files (.env.*).
- .env file is always included, duplicate variables are overwritten by the specific mode file (.env.*).