tinymist/tools/editor-tools/vite.config.js
Myriad-Dreamin 78f3893185
feat: provide package view and local documentation (#596)
* feat: move featured components

* feat: provide package view and local documentation

* stage

* fix: compile error by merged commits
2024-09-12 21:17:07 +08:00

31 lines
734 B
JavaScript

import { defineConfig } from "vite";
import { viteSingleFile } from "vite-plugin-singlefile";
// /src/main.ts
const compPrefix = '--component=';
const componentArgs = process.argv.find(arg => arg.startsWith(compPrefix));
let output = 'dist/default';
if (componentArgs) {
const component = componentArgs.substring(compPrefix.length);
process.env.VITE_ENTRY = `/src/main.${component}.ts`;
output = `dist/${component}`;
} else {
process.env.VITE_ENTRY = '/src/main.ts';
}
export default defineConfig({
plugins: [viteSingleFile()],
assetsInclude: ["**/*.onnx"],
build: {
minify: false,
outDir: output
},
optimizeDeps: {
esbuildOptions: {
loader: {
".onnx": "dataurl",
},
}
}
});