rdkit / RDKitjs-legacy

Obsolete codebase, please do not use.
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

Cannot import the module with require('rdkit') #26

Closed martin-sicho closed 4 years ago

martin-sicho commented 4 years ago

I wanted to test the library (would be really cool to have RDKit in the browser!), but unfortunately was unable to get it to work. I am using what I assume is the latest version (0.5.1) from npm.

When I execute the following code:

const RDKit = require('rdkit'); // using 'rdkit' because 'RDKit' from the README did not work for me

I am getting the following error:

TypeError: rdkit.wast is not a valid URL.

Callstack:

locateFile rdkit.js:21
    integrateWasmJS rdkit.js:63
    rdk rdkit.js:63
    js rdkit.js:77
    __WEBPACK_AMD_DEFINE_RESULT__ rdkit.js:52
    js rdkit.js:53
    js rdkit.js:59
    js 1.chunk.js:289967
    Webpack 28

Relevant code bit:

  18 | var path = getCurrentPathBrowser();
  19 | var Module = {
  20 |   locateFile(url) {
> 21 |     return new URL(url, path).href;
     | ^  22 |   },
  23 |   onRuntimeInitialized() {
  24 |     resolve();

Any idea? Thanks!

greglandrum commented 4 years ago

Hi @martin-sicho : we aren't really supporting this any more (and should indicate that in the documentation). There's a new JS wrapper for using the RDKit in the browser that's part of the core RDKit. There's a description with some background info here: http://rdkit.blogspot.com/2019/11/introducing-new-rdkit-javascript.html

martin-sicho commented 4 years ago

Ahh, ok. For some reason I thought this was the new wrapper (I guess I was too excited to notice the project has not seen any real updates lately). Thanks!

thegodone commented 4 years ago

please use the more supported version https://github.com/rdkit/rdkit/tree/master/Code/MinimalLib

rmrmg commented 4 years ago

@greglandrum Maybe it worth to update npm package to currect version or create new npm package?

greglandrum commented 4 years ago

We should probably delete the npm package. I'd be happy to make uploading the new package to npm part of the standard rdkit release cycle if

  1. it's ok to upload large wasm files to npm
  2. someone explains to me how to do it Note that I have limited time to invest in figuring this stuff out.