1 Star 2 Fork 0

feng3d/renderer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
feng 提交于 2024-06-27 17:35 . 构建示例
// @see https://cn.vitejs.dev/guide/build.html#library-mode
import { resolve } from "path";
import { defineConfig } from "vite";
import pkg from "./package.json";
const namespace = "feng3d";
const external = pkg.standalone ? [] : Object.keys(pkg.dependencies || []);
const globals = () => namespace;
export default defineConfig({
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/index.ts"),
name: namespace,
// the proper extensions will be added
fileName: "index",
},
minify: false,
sourcemap: true,
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external,
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals,
},
},
},
plugins: [
shaderToString(),
]
});
function shaderToString()
{
return {
name: "vite-plugin-string",
async transform(source, id)
{
if (!["glsl", "wgsl", "vert", "frag", "vs", "fs"].includes(id.split(".").pop())) return;
const esm = `export default \`${source}\`;`;
return { code: esm, map: { mappings: "" } };
},
};
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/feng3d/renderer.git
git@gitee.com:feng3d/renderer.git
feng3d
renderer
renderer
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385