Skip to content

Commit

Permalink
feat: 修改ts路径配置
Browse files Browse the repository at this point in the history
  • Loading branch information
niyg-mw committed Nov 13, 2023
1 parent 3d5229e commit 59330b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function MiniDrawer() {
const { active, dialogOpen, activeApp } = useGlobaltore((state) => state);
const Component = React.useMemo(() => {
if (!activeApp) return null;
return React.lazy(() => import(`./components/Pages/${activeApp}`));
return React.lazy(() => import(`@/components/Pages/${activeApp}`));
}, [activeApp]);
return (
<Paper
Expand Down
2 changes: 1 addition & 1 deletion src/components/GlobalPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, BoxProps, styled } from "@mui/material";
import { useSpring, animated } from "@react-spring/web";
import React, { memo } from "react";

import { useGlobaltore } from "../../store/global";
import { useGlobaltore } from "@/store/global";

interface IProps extends BoxProps {
delay?: number;
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.vit/*"]
}
},
"include": ["src", "./.eslintrc.cjs"],
"references": [
Expand Down
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import react from "@vitejs/plugin-react-swc";
export default defineConfig({
base: "/mui-pad-hmi/",
plugins: [react()],
resolve: {
alias: {
"@": "/src",
},
},
optimizeDeps: {
include: ["react/jsx-runtime"],
},
Expand Down

0 comments on commit 59330b7

Please sign in to comment.