hyperledger / iroha-javascript

JavaScript library for Iroha, a Distributed Ledger Technology (blockchain) platform.
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
94 stars 64 forks source link

Webpack issues/recommendation #16

Closed theofilis closed 6 years ago

theofilis commented 7 years ago

I update webpack configuration according to Yves recommendations.

oimou commented 7 years ago

Hi, I'm Keiji. Let me make sure one thing about how to manage 3rd-party libraries.

According to gh-pages branch, 3rd-party libraries (supercop.js and js-sha3.js) were bundled into ./dist/iroha.js before. And, by recent changes, 3rd-party libraries are now excluded from bundled file. (For what I've seen, this PR is a configuration for this.)

When I was looking over this PR, I found that iroha-javascript doesn't work on browser.

Steps to reproduce

  1. npm run build:web and build irohajs.js
  2. Prepare a simple html like this:
<!DOCTYPE html>
<html>
<head>
        <!-- Load 3rd-party libraries where placed to the same directory by hand -->
    <script src="./supercop.js"></script>
    <script src="./js-sha3.js"></script>
    <script src="./irohajs.js"></script>
</head>
<body>
    <h1>iroha web client</h1>
</body>
</html>
  1. Open it in browser and see console outputs.

Expected

No error.

Actual

Uncaught TypeError: Cannot read property 'sha3_256' of undefined
    at Object.<anonymous> (irohajs.ts:6)
    at Object.r.exports (irohajs.js:1943)
    at r (bootstrap 77e0038…:19)
    at bootstrap 77e0038…:65
    at bootstrap 77e0038…:65
    at universalModuleDefinition:9
    at universalModuleDefinition:9

My system environment

Browser: Chrome Version 58.0.3029.81 (64-bit) Node: v7.9.0 NPM: v4.2.0

Cause

The cause probably be that neither supercop.js nor js-sha3.js can be loaded by Githubissues.

  • Githubissues is a development platform for aggregating issues.