原文地址:module-alias - npm (npmjs.com)
Install:
npm i --save module-alias
Usage:
Add your custom configuration to your package.json (in your application's root)
"_moduleAliases": { "@": ".", "api": "./api" // 你可以使用api代替./api }, "_moduleDirectories": ["node_modules_custom"]
Then add this line at the very main file of your app, before any code
require('module-alias/register')
网友评论