1 Star 0 Fork 54

teamwork/image-editor

forked from mantou/image-editor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 2.60 KB
一键复制 编辑 原始数据 按行查看 历史
mantou 提交于 2024-04-09 14:11 . 修复代理BUG
import { defineConfig } from "vite";
//@ts-ignore
import path from "path";
import react from "@vitejs/plugin-react";
import vitePluginImp from "vite-plugin-imp";
//@ts-ignore
const resolve = (url) => path.resolve(__dirname, url);
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
"@components": resolve("./src/components"),
"@server": resolve("./src/server"),
"@pages": resolve("./src/pages"),
"@language": resolve("./src/language"),
"@hooks": resolve("./src/hooks"),
"@theme": resolve("./src/theme"),
"@layout": resolve("./src/layout"),
"@stores": resolve("./src/stores"),
"@utils": resolve("./src/utils"),
"@config": resolve("./src/config"),
"@less": resolve("./src/less"),
"@images": resolve("./src/assets/images"),
},
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"], // 省略扩展名
},
plugins: [
react({
babel: {
plugins: [
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
],
},
}),
vitePluginImp({
libList: [
{
libName: "@icon-park/react",
libDirectory: "es/icons",
camel2DashComponentName: false,
},
{
libName: "lodash",
libDirectory: "",
camel2DashComponentName: false,
},
// {
// libName: '@douyinfe/semi-ui',
// },
],
}),
],
css: {
modules: {
generateScopedName: "[name]__[local]__[hash:5]",
},
preprocessorOptions: {
less: {
// 支持内联 javascript
javascriptEnabled: true,
},
},
},
// 入口
build: {
rollupOptions: {
output: {
chunkFileNames: "editorAssets/js/[name]-[hash].js",
entryFileNames: "editorAssets/js/[name]-[hash].js",
assetFileNames: "editorAssets/[ext]/[name]-[hash].[ext]",
},
input: {
main: resolve("index.html"),
},
},
minify: "terser",
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
base: "/", // 公共基础路径
server: {
host: "0.0.0.0",
port: 3004,
proxy: {
'/cgi-bin': {
target: 'https://image.h5ds.com',
changeOrigin: true,
},
'/api': {
target: 'https://image.h5ds.com',
changeOrigin: true,
},
'/fonts': {
target: 'https://cdn.h5ds.com/assets',
changeOrigin: true,
},
},
},
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/teamwork/image-editor.git
git@gitee.com:teamwork/image-editor.git
teamwork
image-editor
image-editor
master

搜索帮助