Update import paths with alias
- Replace relative import paths with '@/...' alias in multiple files. - Update tsconfig.json to include paths configuration. - Add alias configuration to webpack.config.js.
This commit is contained in:
parent
9a906a1c0f
commit
bcdc78d65f
@ -2,9 +2,9 @@ import * as React from 'react';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import { MantineProvider } from '@mantine/core';
|
import { MantineProvider } from '@mantine/core';
|
||||||
import App from './views/App';
|
|
||||||
import { store } from './views/store';
|
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
import App from '@/views/App';
|
||||||
|
import { store } from '@/views/store';
|
||||||
|
|
||||||
const container = document.getElementById('app')!;
|
const container = document.getElementById('app')!;
|
||||||
const root = createRoot(container); // createRoot(container!) if you use TypeScript
|
const root = createRoot(container); // createRoot(container!) if you use TypeScript
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
AppShell,
|
AppShell,
|
||||||
useMantineTheme,
|
useMantineTheme,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import ChatPanel from './ChatPanel';
|
import ChatPanel from '@/views/ChatPanel';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const theme = useMantineTheme();
|
const theme = useMantineTheme();
|
||||||
|
@ -5,8 +5,8 @@ import { ScrollArea } from '@mantine/core';
|
|||||||
import { Button } from '@mantine/core';
|
import { Button } from '@mantine/core';
|
||||||
import { useListState, useResizeObserver, useTimeout, useViewportSize } from '@mantine/hooks';
|
import { useListState, useResizeObserver, useTimeout, useViewportSize } from '@mantine/hooks';
|
||||||
import { IconPlayerStop, IconRotateDot } from '@tabler/icons-react';
|
import { IconPlayerStop, IconRotateDot } from '@tabler/icons-react';
|
||||||
import messageUtil from '../util/MessageUtil';
|
import messageUtil from '@/util/MessageUtil';
|
||||||
import { useAppDispatch, useAppSelector } from './hooks';
|
import { useAppDispatch, useAppSelector } from '@/views/hooks';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setValue
|
setValue
|
||||||
|
@ -5,7 +5,7 @@ import ReactMarkdown from "react-markdown";
|
|||||||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||||
import { okaidia } from "react-syntax-highlighter/dist/esm/styles/prism";
|
import { okaidia } from "react-syntax-highlighter/dist/esm/styles/prism";
|
||||||
|
|
||||||
import messageUtil from '../util/MessageUtil';
|
import messageUtil from '@/util/MessageUtil';
|
||||||
|
|
||||||
const CodeBlock = (props: any) => {
|
const CodeBlock = (props: any) => {
|
||||||
const { messageText } = props;
|
const { messageText } = props;
|
||||||
|
@ -3,8 +3,8 @@ import { useListState, useResizeObserver } from "@mantine/hooks";
|
|||||||
import { IconGitBranch, IconBook, IconX, IconSquareRoundedPlus, IconSend } from "@tabler/icons-react";
|
import { IconGitBranch, IconBook, IconX, IconSquareRoundedPlus, IconSend } from "@tabler/icons-react";
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { IconGitBranchChecked, IconShellCommand, IconMouseRightClick } from "./Icons";
|
import { IconGitBranchChecked, IconShellCommand, IconMouseRightClick } from "./Icons";
|
||||||
import messageUtil from '../util/MessageUtil';
|
import messageUtil from '@/util/MessageUtil';
|
||||||
import { useAppDispatch, useAppSelector } from './hooks';
|
import { useAppDispatch, useAppSelector } from '@/views/hooks';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setValue,
|
setValue,
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { keyframes } from "@emotion/react";
|
import { keyframes } from "@emotion/react";
|
||||||
import { Center, Text, Flex, Avatar, Accordion, Box, Stack, Container, Divider, ActionIcon, Tooltip } from "@mantine/core";
|
import { Center, Text, Flex, Avatar, Accordion, Box, Stack, Container, Divider, ActionIcon, Tooltip } from "@mantine/core";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import CodeBlock from "./CodeBlock";
|
import CodeBlock from "@/views/CodeBlock";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import SvgAvatarDevChat from './avatar_devchat.svg';
|
import SvgAvatarDevChat from '@/views/avatar_devchat.svg';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import SvgAvatarUser from './avatar_spaceman.png';
|
import SvgAvatarUser from '@/views/avatar_spaceman.png';
|
||||||
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
||||||
|
|
||||||
import { useAppDispatch, useAppSelector } from './hooks';
|
import { useAppDispatch, useAppSelector } from '@/views/hooks';
|
||||||
import {
|
import {
|
||||||
selectGenerating,
|
selectGenerating,
|
||||||
selectResponsed,
|
selectResponsed,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
import messageUtil from '../util/MessageUtil';
|
import messageUtil from '@/util/MessageUtil';
|
||||||
import type { RootState } from './store';
|
import type { RootState } from '@/views/store';
|
||||||
|
|
||||||
export const fetchHistoryMessages = createAsyncThunk<{ command: string; entries: [] }>('input/fetchHistoryMessages', async () => {
|
export const fetchHistoryMessages = createAsyncThunk<{ command: string; entries: [] }>('input/fetchHistoryMessages', async () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
||||||
import type { RootState, AppDispatch } from './store';
|
import type { RootState, AppDispatch } from '@/views/store';
|
||||||
|
|
||||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
import type { RootState } from './store';
|
import type { RootState } from '@/views/store';
|
||||||
import messageUtil from '../util/MessageUtil';
|
import messageUtil from '@/util/MessageUtil';
|
||||||
|
|
||||||
export const fetchContextMenus = createAsyncThunk('input/fetchContextMenus', async () => {
|
export const fetchContextMenus = createAsyncThunk('input/fetchContextMenus', async () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { configureStore } from '@reduxjs/toolkit';
|
import { configureStore } from '@reduxjs/toolkit';
|
||||||
import inputReducer from './inputSlice';
|
import inputReducer from '@/views/inputSlice';
|
||||||
import chatReducer from './chatSlice';
|
import chatReducer from '@/views/chatSlice';
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
|
@ -13,7 +13,12 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noImplicitAny": false
|
"noImplicitAny": false,
|
||||||
|
"paths": {
|
||||||
|
"@/*": [
|
||||||
|
"./src/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"test"
|
"test"
|
||||||
|
@ -75,7 +75,10 @@ const webviewConfig = {
|
|||||||
filename: 'index.js',
|
filename: 'index.js',
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.js', '.json']
|
extensions: ['.ts', '.tsx', '.js', '.json'],
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, 'src/')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user