josdejong / josdejong/mathjs

Load mathjs in a browser module (ES import)

Open
#1,841 13 comments 4 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Currently it looks like it's not possible to use mathjs in a browser module like:

```html

import { create, all } from 'mathjs'

```

I think the existing bundles in `dist` do not have the right exports to be consumed as an ES module.

What should work (but doesn't) is loading like:

```
import { create, all} from 'mathjs/main/es/index.js'
```

I think the reason is that many import paths in the code are missing the explicit "*.js" extension, which is the normal way to go in nodejs and webpack environments, but not in browser ES environments which require a real path to a file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.