wabt.js
wabt.js copied to clipboard
Why use fs?
I want to use wabt in my next.s project via npm package.
Obviously, fs doesn't exist in browser environment so the import fails when next.js tries to bundle the package.
Is there a workaround without including <script> directly into HTML?
If no, why wabt needs fs? Can it be split in two so I can only load parseWat which (i suppose) should not depend on fs?
Thanks.
Same issue with Create-React-App. This can be solved by first checking for window:
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
if(!isBrowser){
// Load fs, path
}