riatelab / dicopal.js

Discrete color palettes (hundreds of them!) for JavaScript
https://npmjs.com/package/dicopal
Apache License 2.0
32 stars 0 forks source link

Angular compile Error: Module not found: Error: Default condition should be last one #4

Closed joewdavies closed 9 months ago

joewdavies commented 9 months ago

Hi!

Once again, thank you for your work.

Just wanted to let you know about an error I found when installing the latest version of Dicopal in my Angular project:

From version 0.5.0 I am getting the following error after installation, when compiling our Angular 17 app:

Error: Module not found: Error: Default condition should be last one

Version 0.4.0 works perfectly, but 0.5.0 and 0.6.0 both return the same error.

I have found a workaround by importing Dicopal as a script in our index.html instead of npm/yarn.

Thanks! Joe

mthh commented 9 months ago

Thank you for your feedback! Actually, starting from version 0.5 I changed the target formats for compiling dicopal (currently it's compiled to "umd" and "esm" formats whereas before it was compiled to "umd" and "cjs" formats), so I imagine it's related.

I'll try to publish a new version tomorrow that fixes that.

mthh commented 9 months ago

In fact, it seems that the error message you're reporting refers to the order of the elements in the exports field in this library's package.json. I have modified this and published a new version (0.6.1). Can you test it and tell me if it fixes the problem? Thanks!

joewdavies commented 9 months ago

Thanks, but same issue i'm afraid!

Error: export 'getColors' (imported as 'getColors') was not found in 'dicopal' (module has no exports)

( I have tried both import { getColors } from "dicopal" and import * as Dicopal from "dicopal" )

In fact, I previously tried reordering the exports field in my node_modules as you have done, but had the same error as a result.

mthh commented 9 months ago

Thank you for your feedback! A new error message...well, let's say we're making progress :)

I can't seem to trigger the bug on my end (I tried with a fresh Vite project and with a fresh Angular project but no issue).

Could you provide me with some additional information? Notably, what is your setup (node.js version, npm/yarn version, are you using something like Webpack, Vite, Angular cli, etc.)?

Thanks !

joewdavies commented 9 months ago

Haha exactly! :)

It seems that the issue is in fact on my side.

I am using EUI to generate the Angular SPA and after generating a fresh project, it works.

There must be something wrong somewhere in my project that is causing it. Just strange that it only occurs with this dependency! I have tried the usual deletion of node_modules, clearing npm and yarn cache etc but to no avail!

If all else fails I will just copy everything over to the new project.

Apologies for the inconvenience and once again thanks for the great library, you can see it in action here ( unbalanced diverging coming soon 😀 )

mthh commented 9 months ago

Just strange that it only occurs with this dependency!

Apologies for the inconvenience

No problem! Don't hesitate to tell me if it turns out there is something actionable on my side!

you can see it in action here ( unbalanced diverging coming soon 😀 )

Awesome ! The app looks great :+1: