I have this how do you make your custom module global accross you project and import it by providing the name of the module rather than the path like the modules in npm ecosystem
import CustomModule from "custom-modules";
After looking for a while i found the answer. You have to add your exports in package.json in order to use them with the name or path provided in package.json. eg
{
"name": "my-mod",
"exports": {
".": "./lib/index.js",
"./lib": "./lib/index.js",
"./lib/index": "./lib/index.js",
"./lib/index.js": "./lib/index.js",
"./feature": "./feature/index.js",
"./feature/index.js": "./feature/index.js",
"./package.json": "./package.json"
}
}
You can go Here for more details
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.