I'm currently working on a library (written in TypeScript) for Angular 4.x. The necessary JavaScript bundles are created with Rollup. It all worked fine until I added the big.js library and the corresponding typings (@types/big.js
).
I import it like this:
import * as Big from 'big.js';
import BigJS = BigJsLibrary.BigJS;
And use it like this:
// instantiating
let bigValue = Big(value);
// example of parameter usage
private someFunction(value: BigJS) { /* some code */ }
When running Rollup, I now receive the following error: Error: Cannot call a namespace ('Big')
. My first thought was to add big.js
to the list of externals for Rollup (external: [ 'big.js' ]
). This does not solve the problem however.
I could see that the BigJS library has no (default) exports, so I tried using the commonjs and nodeResolve Rollup plugins like this:
plugins: [
nodeResolve({
jsnext: true,
main: true
}),
commonjs({})
]
I have a feeling that I'm overseeing something obvious. I'd be thankful if someone could point out the mistake that I'm making here.