mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Initial Vite migration setup
This commit is contained in:
parent
7c58477382
commit
35171070a1
88 changed files with 3341 additions and 3664 deletions
1
packages/common/index.js
Normal file
1
packages/common/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export {}
|
|
@ -2,18 +2,18 @@
|
|||
"name": "@excalidraw/common",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"main": "./dist/common.umd.js",
|
||||
"module": "./dist/common.es.js",
|
||||
"types": "./dist/types/common/src/index.d.ts",
|
||||
"main": "./dist/prod/index.js",
|
||||
"module": "./dist/prod/index.js",
|
||||
"dependencies": {
|
||||
"@excalidraw/math": "0.1.0"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/types/common/src/index.d.ts",
|
||||
"development": "./dist/dev/index.js",
|
||||
"production": "./dist/prod/index.js",
|
||||
"default": "./dist/prod/index.js"
|
||||
},
|
||||
"./*": {
|
||||
"types": "./../common/dist/types/common/src/*.d.ts"
|
||||
"import": "./dist/common.es.js",
|
||||
"require": "./dist/common.umd.js",
|
||||
"default": "./dist/common.es.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
|
@ -50,7 +50,12 @@
|
|||
"bugs": "https://github.com/excalidraw/excalidraw/issues",
|
||||
"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"
|
||||
"gen:types": "if exist types rmdir /s /q types && tsc",
|
||||
"build:esm": "if exist dist rmdir /s /q 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 ."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,8 @@ import {
|
|||
type LocalPoint,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
console.log(pointFromPair);
|
||||
|
||||
import type { NullableGridSize } from "@excalidraw/excalidraw/types";
|
||||
|
||||
export const getSizeFromPoints = (
|
||||
|
|
34
packages/common/vite.config.ts
Normal file
34
packages/common/vite.config.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'path';
|
||||
|
||||
console.log('Alias set to:', path.resolve(__dirname, '../math/dist/math.es.js'));
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
||||
name: 'ExcalidrawCommon',
|
||||
fileName: (format) => `common.${format}.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ['react', 'react-dom'],
|
||||
output: {
|
||||
globals: {
|
||||
react: 'React',
|
||||
'react-dom': 'ReactDOM'
|
||||
},
|
||||
format: 'es'
|
||||
},
|
||||
onwarn: (warning, warn) => {
|
||||
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
|
||||
warn(warning);
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@excalidraw/math': path.resolve(__dirname, '../math/dist/math.es.js')
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue