Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not provided when trying to use a library #840

Closed
aratare-jp opened this issue Feb 10, 2021 · 6 comments
Closed

Module not provided when trying to use a library #840

aratare-jp opened this issue Feb 10, 2021 · 6 comments

Comments

@aratare-jp
Copy link

Context

Hi there. I'm working on a shadow-cljs project with ElasticUI library and trying to display a simple component before encountering a weird error. See more details below.

Problem

When trying to use EuiIcon component, either via reagent/adapt-react-class or com.fulcrologic.fulcro.algorithms.react-interop/react-factory produces

Uncaught (in promise) Module not provided: ./assets/plus.js

in the browser console, and

:shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/@elastic/eui/lib/components/icon/icon.js", :requires [{:line 576, :column 39}]}

in the terminal.

Here's a little project that can reproduce the error: https://github.com/aratare-jp/shadow-cljs-require

Tried solutions

Overall I've tried all these solutions:

  • Different icons -> same error
  • Refreshing the page -> same error
  • Restarting the app -> same error
  • Nuking everything and going from ground zero -> same error
  • Trying pure JS test project with the library -> library works fine, so perhaps something on the shadow-cljs side

Expectation

There should be an icon appearing on the page.

@thheller
Copy link
Owner

The library in question uses dynamic import() in the code which is not supported. In their case the published library is actually rewritten to a dynamic require() call but that is not supported as well.

You can use webpack as described here. This library will not work with shadow-cljs alone.

@aratare-jp
Copy link
Author

Hi there @thheller. I've moved to webpack and can indeed confirm that it works now. Many thanks :)

@jurkotroll
Copy link

Hi there @thheller. I've moved to webpack and can indeed confirm that it works now. Many thanks :)

Would you share?

@aratare-jp
Copy link
Author

@jurkotroll Hi there. I'll make a commit on that repository some time tomorrow if that's okay :)

@jurkotroll
Copy link

@aratare-jp Thank you! :)

@aratare-jp
Copy link
Author

@jurkotroll Hi there. Sorry for the delay. You can now check out https://github.com/aratare-jp/shadow-cljs-require/tree/solution

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants