js-quantities icon indicating copy to clipboard operation
js-quantities copied to clipboard

Can't import the ES module in Angular

Open ozkoidi opened this issue 2 years ago • 4 comments

Hello,

I'm trying to import the ES module version of the library in an Angular 15 project and I get the following error:

image

I see that there is an export in package.json but it doesn't seem to work.

Aditional info: I installed the dependency "js-quantities": "^1.8.0" and the devDependency @types/js-quantities": "^1.6.3"

ozkoidi avatar Sep 13 '23 14:09 ozkoidi

Hi. Could you try import Qty from 'js-quantities';?

gentooboontoo avatar Sep 14 '23 19:09 gentooboontoo

Yes, that works but it doesn't use the ES module version right? Which is the one I'm trying to use

ozkoidi avatar Sep 15 '23 12:09 ozkoidi

Same here!

godind avatar Oct 25 '23 04:10 godind

To add more valuable context: using import Qty from 'js-quantities'; works fine but I get the following...obvious I guess!

Warning: /.../.service.ts depends on 'js-quantities'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

godind avatar Oct 25 '23 22:10 godind