Open dOrgJelli opened 4 years ago
The reason for this being necessary is that graph-cli
is a node application, and dApps are browser based applications. graph-cli
imports the mutations module to verify it exports things properly.
This means that by default the mutations module must be usable in both browser & node target environments.
We have not seen success bundling an ES5 monolithic module that works for both Node & Web. We've tried this using Webpack & Babel. You can find the project we tried this in here: https://github.com/dOrgTech/the-graph-mutations-spec/tree/master/example/subgraph/src/mutations
In order to test this, I'd suggest creating a simple test project that has 3 folders:
bundle
- simple Typescript project that includes some commonly used packages like ipfs-https-client & ethers.js.node-app
- simple node app that includesbundle
's built module.web-app
- simple web app that includesbundle
's built module.More discussion around this issue can be found here: https://github.com/graphprotocol/rfcs/pull/10#discussion_r370540802