-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Using with Rollup #1232
Comments
Thanks for reporting. I don't have much experience with rollup. I just spend 20 minutes trying to get a simple rollup config working but I can't even get a function imported and bundled from lodash (messing around with rollup-plugin-node-resolve). I'm sorry. I would like to try in a simple stand alone setup without TypeScript to be sure whether the issue originates in TypeScript or rollup. |
It's probably because of your custom lazy loading / importing logic. Rollup is not very good at handling things automagically. Thanks for taking the time to look into this, I'll try fixing it in my spare time as well. |
Thanks. Maybe importing a bundle from |
For me, the following works:
Then you can do: import * as math from 'mathjs'; |
Thanks for your input. It can very well be that this issue is fixed in v6, which moved from commonjs to ES6 modules. @smddzcy can you give v6 a try? |
I fail to import mathjs with Rollup too. (I am posting my problem here, as the name of the issue matches, and the issue is open and otherwise not alive.) Reported problems: For some scripts (typed-function.js among them) I have tried multiple ways of importing, including:
All of them fail. Update: Looks like the error is using |
@EliasHasle thanks for reporting. Can you try import {create, all} from "mathjs/main/es6/";
const math = create(all); explicitly pointing to the ES6 code? |
I now tried:
with Since for now I only need the FibonacciHeap, I will use https://github.com/gwtw/ts-fibonacci-heap instead (with similar/identical API). But I am interested in benefiting from mathjs later, preferably without having to bundle the whole library. :-) Update: I think I misunderstood the behavior of the commonjs plugin. I solved building only typed-function in josdejong/typed-function#18 (comment) |
This issue is most likely fixed in EDIT: only relevant for Elias |
I can confirm that my issue is resolved with 6.0.4. Thanks! 😄 |
That's great to hear, thanks for the feedback. Since multiple people report they can successfully use mathjs in their rollup projects I'll close this issue now. |
We're currently having problems using this library with Rollup. Here's the error:
And my Rollup config:
Am I doing something wrong or is it related to your exports?
The text was updated successfully, but these errors were encountered: