mirror of
https://github.com/sunniejs/vue-h5-template.git
synced 2025-04-05 19:42:08 +08:00
20 lines
525 B
Markdown
20 lines
525 B
Markdown
# 配置 alias 别名
|
|
|
|
```javascript
|
|
const path = require("path");
|
|
const resolve = (dir) => path.join(__dirname, dir);
|
|
const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);
|
|
|
|
module.exports = {
|
|
chainWebpack: (config) => {
|
|
// 添加别名
|
|
config.resolve.alias
|
|
.set("@", resolve("src"))
|
|
.set("assets", resolve("src/assets"))
|
|
.set("api", resolve("src/api"))
|
|
.set("views", resolve("src/views"))
|
|
.set("components", resolve("src/components"));
|
|
},
|
|
};
|
|
```
|