加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
答案 提交于 2024-08-25 17:22 . feat:新增嵌入外部代码功能
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import basicSsl from "@vitejs/plugin-basic-ssl";
import { resolve } from "path";
export default defineConfig(mode => {
const { VITE_APP_BASE_URL } = loadEnv(mode.mode, process.cwd());
return {
plugins: [vue(), vueJsx()],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
vue: "vue/dist/vue.esm-bundler.js"
}
},
assetsInclude: ["**/*.hdr", "**/*.glb"],
esbuild: { loader: { ".js": ".jsx" } },
base: VITE_APP_BASE_URL,
server: {
host: "0.0.0.0",
open: true,
port: 9999
},
build: {
outDir: "threejs-3dmodel-edit",
assetsDir: "static",
emptyOutDir: true,
minify: "esbuild",
rollupOptions: {
input: {
index: resolve(__dirname, "index.html"),
preview: resolve(__dirname, "preview.html"),
modelIframe: resolve(__dirname, "modelIframe.html"),
vrPage: resolve(__dirname, "vrPage.html")
},
output: {
compact: true,
entryFileNames: "static/js/[name]-[hash].js",
chunkFileNames: "static/js/[name]-[hash].js",
assetFileNames: "static/[ext]/[name].[ext]"
}
}
}
};
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化