mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 14:14:13 +01:00
playground: basic editor functionality ready
This commit is contained in:
@@ -5,6 +5,8 @@ import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import {name, version} from './package.json'
|
||||
import {execSync} from 'child_process'
|
||||
import { viteStaticCopy } from "vite-plugin-static-copy";
|
||||
import { dirname, join } from "path";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
@@ -18,7 +20,9 @@ export default defineConfig({
|
||||
}
|
||||
}),
|
||||
vueJsx(),
|
||||
viteStaticCopyPyodide(),
|
||||
],
|
||||
optimizeDeps: { exclude: ["pyodide"] },
|
||||
resolve: {
|
||||
alias: {
|
||||
// @ts-ignore
|
||||
@@ -28,8 +32,13 @@ export default defineConfig({
|
||||
build: {
|
||||
assetsDir: '.', // Support deploying to a subdirectory using relative URLs
|
||||
cssCodeSplit: false, // Small enough to inline
|
||||
chunkSizeWarningLimit: 1024, // Three.js is big. Draco is even bigger but not likely to be used.
|
||||
chunkSizeWarningLimit: 1024, // KB. Three.js is big. Draco is even bigger but not likely to be used.
|
||||
sourcemap: true, // For debugging production
|
||||
rollupOptions: {
|
||||
output: {
|
||||
experimentalMinChunkSize: 512000, // 512KB (avoid too many small chunks)
|
||||
}
|
||||
}
|
||||
},
|
||||
define: {
|
||||
__APP_NAME__: JSON.stringify(name),
|
||||
@@ -38,3 +47,22 @@ export default defineConfig({
|
||||
__APP_GIT_DIRTY__: JSON.stringify(execSync('git diff --quiet || echo dirty').toString().trim()),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function viteStaticCopyPyodide() {
|
||||
const PYODIDE_EXCLUDE = [
|
||||
"!**/*.{md,html}",
|
||||
"!**/*.d.ts",
|
||||
"!**/*.whl",
|
||||
"!**/node_modules",
|
||||
];
|
||||
const pyodideDir = dirname(fileURLToPath(import.meta.resolve("pyodide")));
|
||||
return viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
src: [join(pyodideDir, "*")].concat(PYODIDE_EXCLUDE),
|
||||
dest: "assets",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user