Skip to content

Commit

Permalink
Configure vite and ts to use non-relative paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
programmiri committed Oct 25, 2022
1 parent dded222 commit c82b477
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion coral/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "@aivenio/design-system/dist/styles.css";
import App from "@/App";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
Expand Down
4 changes: 4 additions & 0 deletions coral/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
Expand Down
9 changes: 9 additions & 0 deletions coral/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";

const rootPath = resolve(__dirname);
// https://vitejs.dev/config/

// console.log("rootPath", rootPath);
export default defineConfig({
plugins: [react()],
define: {
Expand All @@ -16,4 +20,9 @@ export default defineConfig({
EXAMPLE: "",
},
},
resolve: {
alias: {
"@": resolve(rootPath, "./src"),
},
},
});

0 comments on commit c82b477

Please sign in to comment.