Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
why package.json exports field not working in npm package

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!