mockaroo-node icon indicating copy to clipboard operation
mockaroo-node copied to clipboard

[BUGFIX] CommonJS Imports Broken

Open dallas-scott opened this issue 1 year ago • 0 comments

Issue

The release of v1.0.1, while working locally and passing unit tests, failed to resolve imports when installing the deployed version.


Cause

This happened for two reasons:

  1. package.json was labeled as type: "module", which required the use of import and explicitly disallows the use of require(...)
  2. I included an erroneous default in the export of Client and errors from index.js

Solution

  • I removed the default export from index.js
  • I changed the package.json back to type: "commonjs"
    • Updated imports that complained about this change

Prevention

  • Updated eslint to disallow exporting default in index.js to prevent this from happening again

Maintenance

  • updated ESlint to 8.56.0

dallas-scott avatar Jun 11 '24 22:06 dallas-scott