Add vite build (#53)

* Add vite build - baseline

* Fix build output folder structure

Matches pre-vite output

* Fix litegraph errors introduced by vite process

- Remove pre-written encapsulating iife (one is injected by vite)
- Replace all references to the global "this" with globalThis
This commit is contained in:
filtered
2024-08-06 23:14:17 +10:00
committed by GitHub
parent d2c72243f8
commit ddd1ac4f99
7 changed files with 135 additions and 73 deletions

21
vite.config.mts Normal file
View File

@@ -0,0 +1,21 @@
import { defineConfig } from 'vite'
import path from 'path'
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, 'src/litegraph.js'),
name: 'litegraph.js',
// TODO: Below workaround ensures output matches pre-vite format. Should be removed.
fileName: (moduleFormat, entryAlias) => 'src/litegraph.js',
formats: ['iife']
},
minify: false,
sourcemap: true,
rollupOptions: {
// Disabling tree-shaking
// Prevent vite remove unused exports
treeshake: false
}
},
})