Truffle Decoder cannot be imported in the browser
See original GitHub issueI think this has something to do with the way it’s being webpacked and published. It’s not outputting a module compatible with ES6 import statements. The following fails:
import Decoder from "@truffle/decoder";
console.log(Decoder) // undefined
If you change it to CommonJS require statements, then it works:
const Decoder = require("@truffle/decoder")
console.log(Decoder) // {ContractDecoder: ƒ ...}
But both of the above cases should work properly.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
Truffle and MetaMask
MetaMask is the easiest way to interact with dapps in a browser. It is an extension for Chrome or Firefox that connects to...
Read more >@truffle/decoder - npm
Truffle Decoder. This module, @truffle/decoder , provides an interface for decoding Solidity smart contract state as well as information ...
Read more >ConsenSys/truffle - Gitter
I cannot install Truffle. Process as under: ... Is it being imported? ... import { generateStore } from 'drizzle'; import drizzleOptions from '....
Read more >Module not found: Error: Can't resolve 'crypto' - Stack Overflow
json to serve it on the browser. However, package.json generally includes both server and browser dependencies, and any native module dependency ...
Read more >Fix for PowerShell Script cannot be loaded because running ...
This is due to the Windows PowerShell execution policy being set to prevent untrusted scripts which can affect your Windows client environment.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Another workaround would be to configure webpack to not attempt to import
fs-extra
, as mentioned here: https://github.com/jprichardson/node-fs-extra/issues/261For now you can downgrade to the previous decoder version (4.1.0); you won’t lose much functionality (just some stuff involving internal function pointers which I don’t think you’re currently handling anyway). But yeah will have to do something about this…