美文网首页
17.Node项目使用@代替根目录

17.Node项目使用@代替根目录

作者: 笑着字太黑 | 来源:发表于2021-07-03 12:53 被阅读0次

原文地址: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')

相关文章

网友评论

      本文标题:17.Node项目使用@代替根目录

      本文链接:https://www.haomeiwen.com/subject/mevuultx.html