I have developed an npm package that builds three.js files. in my project I want to import js files like this:
import MyButton from '@bslm/ui/MyButton'
so i used the exports field in my package.json like this:
"type": "module",
"exports": {
"./MyButton": "./dist/my-button.common.js",
"./MyInput": "./dist/my-input.common.js",
"./MyImage": "./dist/my-image.common.js",
}
but when i try:
import MyButton from 'mypackage/MyButton'
I get this error: These dependencies were not found
node version: 14.18.1 npm version: 8.5.4
Remove the leading '.'. If you use './' as the keys you need to use objects like {"default":"./dist/my-button-common.js" } instead of a simple name.
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.