I've got an Angular 2 project and have been using debug with no problems. I'm now trying to use rollup and I get the error:
Cannot call a namespace ('debugModule')
This refers to the way I import debug:
import * as debugModule from 'debug';
I've seen that the solution to this is to import without using the * as someName syntax, like this:
import debug from 'debug';
or maybe:
import { Debug } from 'debug';
...but neither of those work (has no default export and has no exported member 'Debug'). I've done my best to look at the source of both debug and @types/debug
to see what I should import, but all I can see is from @types/debug - there are IDebug and IDebugger interfaces which aren't what I'm looking for.
How should I be importing debug such that rollup will be OK with it?
It looks like I can coerce it into working by calling it this way:
debug = debugModule.call(this, 'module:component');
Although I'm not sure what repercussions that might have going forward...
So I don't know why, but if you have installed
@types/debugthenimport debug from 'debug'won't work, but if you just remove@types/debugthen you can import it. This doesn't solve all the problems I have withdebugwhen using rollup, but it stops theCannot call namespaceproblem and you can calldebugnormally.