lif3ng / todos

坑是要挖的,说不定哪天就填上了
https://lif3ng.github.io/todos
MIT License
1 stars 0 forks source link

路径别名 alias #169

Open lif3ng opened 2 years ago

lif3ng commented 2 years ago

vs code

jsconfig.json / tsconfig.json

https://stackoverflow.com/questions/47181037/vscode-intellisense-does-not-work-with-webpack-alias

{
  "compilerOptions": {
    "baseUrl": ".",
    "module": "commonjs",
    "paths": {
      "@cmp/*": ["./src/components/*"]
    }
  }
}
lif3ng commented 2 years ago

webpack

https://webpack.js.org/configuration/resolve/#resolvealias

lif3ng commented 2 years ago

rollup / vite

https://vitejs.dev/config/#resolve-alias https://www.npmjs.com/package/@rollup/plugin-alias