mljs / xgboost

A port of XGBoost to javascript with emscripten
Other
41 stars 8 forks source link

Does this library load in browser (using webpack)? #8

Open dennismphil opened 6 years ago

dennismphil commented 6 years ago

I have been trying to load this library on the browser using webpack.

First error I see is:

ERROR in ./node_modules/ml-xgboost/dist/wasm/xgboost.wasm
Module not found: Error: Can't resolve 'env' in '/workspace/360/node_modules/ml-xgboost/dist/wasm'
 @ ./node_modules/ml-xgboost/dist/wasm/xgboost.wasm
 @ ./node_modules/ml-xgboost/src/index.js

ERROR in chunk main [entry]
bundle.js
Sync WebAssembly compilation is not yet implemented

After adding the following rule in webpack.config.js,

{
    test: /\.wasm$/,
    loader: 'wasm-loader',
    type: 'javascript/auto'
},

this succeeds.

However, in browser it fails to resolve the promise in ../node_modules/ml-xgboost/src/index.js

Uncaught TypeError: Cannot read property 'then' of undefined

The dynamic loading of library is not working. Have you had any success in getting the library load up in browser?

piotrjaw commented 6 years ago

Hi, any success with that?