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

Compilation fails under shadow-cljs #7

Open
achikin opened this issue Nov 28, 2018 · 2 comments
Open

Compilation fails under shadow-cljs #7

achikin opened this issue Nov 28, 2018 · 2 comments

Comments

@achikin
Copy link

achikin commented Nov 28, 2018

Compilation fails while trying to compile the library with shadow-cljs.
The following error is shown.

The required namespace "decimal.extern.decimaljs" is not available, it was required by "decimal/core.cljs".
@achikin
Copy link
Author

achikin commented Dec 19, 2018

shadow-cljs does not support foreign libs inside cljs libraries. As per Thomas Heller advice - you should fetch decimal.js from npm separately and create the following namespace to make the npm version available to funcool/decimal

;;file: src/cljs/decimal/extern/decimaljs.cljs adjust according to your code layout
(ns decimal.extern.decimaljs
  (:require ["decimal.js" :as decimal-js]))
(js/goog.exportSymbol "Decimal.noConflict" (fn [] decimal-js))

@jjttjj
Copy link

jjttjj commented Sep 7, 2021

While @achikin's solution works, would it be a good idea to support compilation with shadow out of the box? Shadow is somewhat popular these days and it might be a best practice for a small useful library like this to work with at least the most common cljs build tools without having to add an additional namespace.

There is a good writeup on packaging cljs libs here:
https://widdindustries.com/cljs-npm-libraries/

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

2 participants