Setup absolute paths in Vite/TS config
This commit is contained in:
parent
e595cc1135
commit
4c05c872b6
18
src/App.tsx
18
src/App.tsx
|
|
@ -1,16 +1,14 @@
|
||||||
import { createShapeId, TLUiComponents } from "@tldraw/tldraw";
|
|
||||||
import "@tldraw/tldraw/tldraw.css";
|
import "@tldraw/tldraw/tldraw.css";
|
||||||
import "./css/style.css"
|
import "@/css/style.css"
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { } from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import { HTMLShape } from "./ts/shapes/HTMLShapeUtil";
|
import { Default } from "@/ts/components/Default";
|
||||||
import { Default } from "./ts/components/Default";
|
import { Canvas } from "@/ts/components/Canvas";
|
||||||
import { Canvas } from "./ts/components/Canvas";
|
import { Toggle } from "@/ts/components/Toggle";
|
||||||
import { Toggle } from "./ts/components/Toggle";
|
import { usePhysics } from "@/ts/hooks/usePhysics.ts"
|
||||||
import { usePhysics } from "./ts/hooks/usePhysics.ts"
|
import { createShapes } from "@/utils";
|
||||||
import { createShapes } from "./utils";
|
|
||||||
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
||||||
import { Contact } from "./ts/components/Contact.tsx";
|
import { Contact } from "@/ts/components/Contact.tsx";
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
|
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Tldraw, TLShape, TLUiComponents } from "@tldraw/tldraw";
|
import { Tldraw, TLShape, TLUiComponents } from "@tldraw/tldraw";
|
||||||
import { SimController } from "../physics/PhysicsControls";
|
import { SimController } from "@/ts/physics/PhysicsControls";
|
||||||
import { HTMLShapeUtil } from "../shapes/HTMLShapeUtil";
|
import { HTMLShapeUtil } from "@/ts/shapes/HTMLShapeUtil";
|
||||||
|
|
||||||
const components: TLUiComponents = {
|
const components: TLUiComponents = {
|
||||||
HelpMenu: null,
|
HelpMenu: null,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ export function Toggle() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<button id="toggle-physics" onClick={() => window.dispatchEvent(new CustomEvent('togglePhysicsEvent'))}>
|
<button id="toggle-physics" onClick={() => window.dispatchEvent(new CustomEvent('togglePhysicsEvent'))}>
|
||||||
<img src="src/assets/gravity.svg" alt="Toggle Physics" />
|
<img src="assets/gravity.svg" alt="Toggle Physics" />
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./src",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["*"],
|
||||||
|
"src/*": ["./src/*"],
|
||||||
|
},
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
|
@ -21,5 +26,6 @@
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
|
|
||||||
"references": [{ "path": "./tsconfig.node.json" }]
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,9 @@ export default defineConfig({
|
||||||
wasm(),
|
wasm(),
|
||||||
topLevelAwait()
|
topLevelAwait()
|
||||||
],
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': '/src',
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue