diff --git a/package.json b/package.json index 39ea047..56e3e78 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "styled-components": "5.3.5", "styled-jsx": "3.4.5", "typed-immutable-map": "^0.1.1", - "zustand": "4.4.7" + "zustand": "4.4.7", + "$": "link:./src" }, "devDependencies": { "@babel/core": "^7.0.0-0", diff --git a/src/webapp/components/page-header/PageHeader.tsx b/src/webapp/components/page-header/PageHeader.tsx index ef8de55..dc7a4f1 100644 --- a/src/webapp/components/page-header/PageHeader.tsx +++ b/src/webapp/components/page-header/PageHeader.tsx @@ -4,7 +4,7 @@ import Typography from "@material-ui/core/Typography"; import { DialogButton } from "@eyeseetea/d2-ui-components"; import React, { PropsWithChildren } from "react"; import styled from "styled-components"; -import i18n from "../../../utils/i18n"; +import i18n from "$/utils/i18n"; export const PageHeader: React.FC = React.memo(props => { const { variant = "h5", title, onBackClick, helpText, children } = props; diff --git a/tsconfig.json b/tsconfig.json index a4c405d..0b6c2b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,11 @@ "isolatedModules": true, "noUncheckedIndexedAccess": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "baseUrl": "./src", + "paths": { + "$/*": ["./*"] + } }, "include": ["src"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/vite.config.ts b/vite.config.ts index a1dd439..e3e67d4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,6 +3,7 @@ import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; import checker from "vite-plugin-checker"; import nodePolyfills from "vite-plugin-node-stdlib-browser"; +import * as path from "path"; export default ({ mode }) => { const env = { ...process.env, ...loadEnv(mode, process.cwd()) }; @@ -30,6 +31,11 @@ export default ({ mode }) => { port: parseInt(env.VITE_PORT), proxy: proxy, }, + resolve: { + alias: { + $: path.resolve(__dirname, "./src"), + }, + }, }); }; diff --git a/yarn.lock b/yarn.lock index 5ec0500..ddd23ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,10 @@ # yarn lockfile v1 +"$@link:./src": + version "0.0.0" + uid "" + "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6" resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"