ericman314 / UnitMath

JavaScript library for unit conversion and arithmetic
Apache License 2.0
31 stars 7 forks source link

Dependency resolving issue #56

Closed Ollymid closed 1 year ago

Ollymid commented 1 year ago

When I try to compile dependabot update PR for Unitmath v1.0.0 I see the following:

ERROR in ../../node_modules/unitmath/index.js 1:0-36
--
  | Module not found: Error: Can't resolve './src/Unit.js' in '/home/app/current/node_modules/unitmath'
  | resolve './src/Unit.js' in '/home/app/current/node_modules/unitmath'
  | using description file: /home/app/current/node_modules/unitmath/package.json (relative path: .)
  | Field 'browser' doesn't contain a valid alias configuration
  | using description file: /home/app/current/node_modules/unitmath/package.json (relative path: ./src/Unit.js)
  | no extension
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js doesn't exist
  | .ts
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js.ts doesn't exist
  | .tsx
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js.tsx doesn't exist
  | .js
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js.js doesn't exist
  | .jsx
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js.jsx doesn't exist
  | .min.js
  | Field 'browser' doesn't contain a valid alias configuration
  | /home/app/current/node_modules/unitmath/src/Unit.js.min.js doesn't exist
  | as directory
  | /home/app/current/node_modules/unitmath/src/Unit.js doesn't exist

I think it's taking issue with import UnitMath from "./src/Unit.js"; in the index.js as inside /src there is only Unit.ts - should this be changed to Unit.ts for it to work?

Or perhaps something not quite right with rollup config?

ericman314 commented 1 year ago

We have just made a change to the package.json in v1.0.2 that may fix this. Apparently, require and import() were not using the correct entry point. Do you want to give v1.0.2 a try?

Ollymid commented 1 year ago

Hi Eric, fix looks to have worked, PR builds using new version - thanks v much