We're currently in the process of transitioning an app prototype from ionic to ionic2, accomplished by duplicating the functionality of the ionic-conference-app, which is working smoothly on our local environment.
Our next task involves creating a wrapper class for an Ethereum JS library that we possess. The issue arises when attempting to integrate this new class into the ionic-conference-app at src/services/ethereum-service.ts
import eth from 'ethereumjs-util';
export default class EthereumService {
constructor() {}
sha3() : Object {
return eth.sha3("12345454");
}
}
Additionally, within a component such as the About page located at src/pages/about/about.ts
, we add the following code:
export class AboutPage {
private ethereum : EthereumService;
constructor() {
this.ethereum = new EthereumService();
}
}
After compiling without any errors using npm run ionic:serve
, the application fails to load and displays the following error message in the console.
Uncaught Error: Cannot find module "./messages.json" /Users/my.name/my-app/node_modules/secp256k1/lib/index.js:4 at webpackMissingModule ...
Closer inspection reveals that the secp256k1 dependency encounters a problem while trying to load the following line.
var messages = require('./messages.json')
In an attempt to resolve this issue, we have included the webpack/json-loader as a dependency in package.json
.
For reference, our project uses "@ionic/app-scripts": "0.0.44"
.
We are seeking guidance on importing this dependency correctly. Any assistance would be greatly appreciated.