Unable to dynamically load npm-modules in ionic

2019-08-28 11:05发布

I am running into an issue using the combination of the hyberledger-composer-common npm module and ionic. Basic setting up works as expected but when i am trying to connect to the hyperledger network it throws the following error:

Error: Failed to load connector module "composer-connector-hlfv1" for connection profile "Default". curmod.require is not a function-connectionManagerLoader.require is not a function-connectionManagerLoader.require is not a function-Cannot find module "."
    at connectionProfileStore.load.then (connectionprofilemanager.js:160)
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (core.es5.js:3890)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:3881)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)

I am fairy new to using ionic and javascript builders so i have no clue where to look. I am guessing it has something to do with polyfills and the way ionic handles paths but i am not sure. Could anyone give me a bump in the right direction?

The application also throws a similar error while trying to instantiate the loggerclass:

Failed to load logger module ./winstonInjector.js: Cannot find module "."

The implementation is as follows:

//example
var loggerToUse = './winstonInjector.js';
myLogger = require(loggerToUse);

Which gave me the idea the issue is regarding dynamically loading modules :)

0条回答
登录 后发表回答