Recently, I created an npm package that includes three js files. Now, in my current project, I am aiming to import these js files using the following syntax:
import MyButton from '@bslm/ui/MyButton'
To achieve this, I made sure to specify the exports field within my package.json, as illustrated below:
"type": "module",
"exports": {
"./MyButton": "./dist/my-button.common.js",
"./MyInput": "./dist/my-input.common.js",
"./MyImage": "./dist/my-image.common.js",
}
However, upon attempting to execute the following import statement:
import MyButton from 'mypackage/MyButton'
An error message stating
These dependencies were not found
is displayed.
For context, my node version stands at 14.18.1 and npm version at 8.5.4.