Initial Vite migration setup

This commit is contained in:
BlackWolfNews 2025-04-13 17:46:38 -06:00
parent 7c58477382
commit 35171070a1
88 changed files with 3341 additions and 3664 deletions

View file

@ -3,14 +3,14 @@
"version": "0.1.0",
"type": "module",
"types": "./dist/types/math/src/index.d.ts",
"main": "./dist/prod/index.js",
"module": "./dist/prod/index.js",
"main": "./dist/math.umd.js",
"module": "./dist/math.es.js",
"exports": {
".": {
"types": "./dist/types/math/src/index.d.ts",
"development": "./dist/dev/index.js",
"production": "./dist/prod/index.js",
"default": "./dist/prod/index.js"
"development": "./dist/math.es.js",
"production": "./dist/math.umd.js",
"default": "./dist/math.umd.js"
},
"./*": {
"types": "./../math/dist/types/math/src/*.d.ts"
@ -55,6 +55,11 @@
"repository": "https://github.com/excalidraw/excalidraw",
"scripts": {
"gen:types": "rm -rf types && tsc",
"build:esm": "rm -rf dist && node ../../scripts/buildBase.js && yarn gen:types"
"build:esm": "rm -rf dist && node ../../scripts/buildBase.js && yarn gen:types",
"build": "vite build",
"test": "jest",
"lint": "eslint . --ext .ts,.tsx",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write ."
}
}

View file

@ -0,0 +1,27 @@
import { defineConfig } from 'vite';
import { fileURLToPath } from 'node:url';
export default defineConfig({
build: {
lib: {
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
name: 'ExcalidrawMath',
fileName: () => 'index.js', // Changed to match package.json
},
outDir: 'dist/prod', // Added to match package.json
rollupOptions: {
external: ['react', 'react-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM'
},
format: 'es' // Still produces ESM; UMD needs separate config if required
},
onwarn: (warning, warn) => {
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
warn(warning);
}
}
}
});