I have been working on an Angular 2 project and encountered no issues while using debug. However, when I attempted to integrate rollup, I faced the following error:
Cannot call a namespace ('debugModule')
This error is related to how I import debug:
import * as debugModule from 'debug';
I discovered that the solution involves importing without using the * as someName
syntax, like this:
import debug from 'debug';
Or perhaps:
import { Debug } from 'debug';
...but unfortunately, neither of these methods work (has no default export
and has no exported member 'Debug'
). After examining both the source code of debug
and @types/debug
,
I only found information in @types/debug
- there are IDebug
and IDebugger
interfaces which do not seem to be what I am looking for.
Could you please advise me on the correct way to import debug
so that it works fine with rollup
?
It seems that I can temporarily fix it by calling it in this manner:
debug = debugModule.call(this, 'module:component');
However, I am unsure about any potential implications this approach might have in the future...