I have looked at every issue I can find that has a reference to the error I'm having when trying to package my Angular component library. The error is:
BUILD ERROR
Cannot call a namespace ('moment')
Error: Cannot call a namespace ('moment')
... //Rest of stack trace
I have tried adding the "allowSyntheticDefaultImports": true,
attribute to my tsconfig.json file, and the "target"
is es6. I tried adding a rollup.config.js
file, and have tried the following ways of importing moment:
import * as moment from 'moment';
and
import moment from 'moment';
and
import * as momentLib from 'moment';
const moment = momentLib;
and
import moment from 'moment-es6';
None of those worked. But I still get the above error, or that there is no default export for moment.
Does anyone have any tips on how to get this to work?