refactor: use ~ as import alias

This commit is contained in:
鲁树人 2023-05-09 01:22:00 +01:00
parent eeb00e0bc9
commit 5ad054631c
7 changed files with 32 additions and 12 deletions

View File

@ -22,6 +22,7 @@
"react-redux": "^8.0.5"
},
"devDependencies": {
"@types/node": "^20.1.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.57.1",

View File

@ -33,6 +33,9 @@ dependencies:
version: 8.0.5(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1)
devDependencies:
'@types/node':
specifier: ^20.1.1
version: 20.1.1
'@types/react':
specifier: ^18.0.28
version: 18.0.28
@ -65,7 +68,7 @@ devDependencies:
version: 5.0.2
vite:
specifier: ^4.3.2
version: 4.3.2
version: 4.3.2(@types/node@20.1.1)
packages:
@ -1867,6 +1870,10 @@ packages:
resolution: {integrity: sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==}
dev: false
/@types/node@20.1.1:
resolution: {integrity: sha512-uKBEevTNb+l6/aCQaKVnUModfEMjAl98lw2Si9P5y4hLu9tm6AlX2ZIoXZX6Wh9lJueYPrGPKk5WMCNHg/u6/A==}
dev: true
/@types/parse-json@4.0.0:
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
dev: false
@ -2037,7 +2044,7 @@ packages:
'@babel/plugin-transform-react-jsx-self': 7.21.0(@babel/core@7.21.8)
'@babel/plugin-transform-react-jsx-source': 7.19.6(@babel/core@7.21.8)
react-refresh: 0.14.0
vite: 4.3.2
vite: 4.3.2(@types/node@20.1.1)
transitivePeerDependencies:
- supports-color
dev: true
@ -3388,7 +3395,7 @@ packages:
react: 18.2.0
dev: false
/vite@4.3.2:
/vite@4.3.2(@types/node@20.1.1):
resolution: {integrity: sha512-9R53Mf+TBoXCYejcL+qFbZde+eZveQLDYd9XgULILLC1a5ZwPaqgmdVpL8/uvw2BM/1TzetWjglwm+3RO+xTyw==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
@ -3413,6 +3420,7 @@ packages:
terser:
optional: true
dependencies:
'@types/node': 20.1.1
esbuild: 0.17.18
postcss: 8.4.23
rollup: 3.21.5

View File

@ -1,5 +1,5 @@
import { ConcurrentQueue } from '../util/ConcurrentQueue';
import { WorkerClientBus } from '../util/WorkerEventBus';
import { ConcurrentQueue } from '~/util/ConcurrentQueue';
import { WorkerClientBus } from '~/util/WorkerEventBus';
import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
// TODO: Worker pool?

View File

@ -1,4 +1,4 @@
import { WorkerServerBus } from '../util/WorkerEventBus';
import { WorkerServerBus } from '~/util/WorkerEventBus';
import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
const bus = new WorkerServerBus();

View File

@ -1,7 +1,7 @@
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import type { PayloadAction } from '@reduxjs/toolkit';
import type { RootState } from '../../store';
import { decryptionQueue } from '../../decrypt-worker/client';
import type { RootState } from '~/store';
import { decryptionQueue } from '~/decrypt-worker/client';
export enum ProcessState {
UNTOUCHED = 'UNTOUCHED',

View File

@ -17,7 +17,12 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]

View File

@ -1,7 +1,13 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
});