question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Truffle Decoder cannot be imported in the browser

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
haltman-atcommented, Mar 31, 2020

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/261

1reaction
haltman-atcommented, Mar 31, 2020

For 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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found