Subwaytime/vite-aliases

rewrite tsconfig.json

admiral20 opened this issue · 1 comments

// vite.config.js
import { ViteAliases } from 'vite-aliases'

plugins: [
    ViteAliases({
        prefix: "@"
    }),
]
// package.json
"devDependencies": {
    vite-aliases": "^0.11.2",
}
// tsconfig.json
{
    "compilerOptions": {
        "isolatedModules": true,
        "strict": true,
        "esModuleInterop": true,
        "noUnusedLocals": true,
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "strictNullChecks": true,
        "forceConsistentCasingInFileNames": true,
        "noEmit": true,
        "paths": {
            "@assets/*": [
                "src/assets/*"
            ],
            "@components/*": [
                "src/components/*"
            ],
            "@layouts/*": [
                "src/layouts/*"
            ],
            "@router/*": [
                "src/router/*"
            ],
            "@views/*": [
                "src/views/*"
            ],
            "@/*": [
                "src/*"
            ],
            "@style/*": [
                "src/style/*"
            ],
            "@stores/*": [
                "src/stores/*"
            ]
        }
    }
}

when npm run dev , the tsconfig.json can be rewrited, someconfig is loss.....

{
    "compilerOptions": {
        "paths": {
            "@assets/*": [
                "src/assets/*"
            ],
            "@components/*": [
                "src/components/*"
            ],
            "@layouts/*": [
                "src/layouts/*"
            ],
            "@router/*": [
                "src/router/*"
            ],
            "@views/*": [
                "src/views/*"
            ],
            "@/*": [
                "src/*"
            ],
            "@style/*": [
                "src/style/*"
            ],
            "@stores/*": [
                "src/stores/*"
            ]
        }
    }
}

Hey, ill take a look! Usually it should only rewrite the paths object.. 🤔
Does the terminal output, it cannot find your tsconfig?