Cannot use rdkit-js easily in NextJS - example limitation? #360
Replies: 4 comments 1 reply
-
You may call initRDKitModule({
locateFile: () => '/path/to/RDKIt_minimal.wasm'
}); where |
Beta Was this translation helpful? Give feedback.
-
I do not use TypeScript myself, but I am pretty sure @MichelML would be happy to review and eventually merge your PR :-) |
Beta Was this translation helpful? Give feedback.
-
@ptosco thanks for this I also didn't know! @sgoodrow-zymergen yes a PR would be appreciated, but also if you could specify this option in the main readme, I think it could help other people to be rapidly aware of this option when using rdkit-js in similar contexts as yours! |
Beta Was this translation helpful? Give feedback.
-
Apologies for the delay, here's the PR: #362 Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi,
We are using
rdkit-js
for molecule image rendering. Thank you for the great library and work, we appreciate it.I am attempting to use the library in a NextJS app. We happen to be using the new "app router" architecture, but I think this issue will exist in the legacy "pages router" architecture as well.
I am trying to use it on the server-side, not in the browser (which I have gotten to work by using the unpkg source in a script tag).
The
rdkit-js
loading script seems to look for the.wasm
file relative to its loading route. This means that if the loading script is called from a particular nested NextJS route path, the.wasm
file has to be at that path location as well.This is not seen in the example NextJS app because the loading script is always called from
/
, so it is expected to be found at/chunks/app
, but if you also load the script from/something
, it will attempt to look for the.wasm
file in/chunks/app/something
.While it is straight-forward to copy the
.wasm
file into that location instead, I'd really like to only ship the.wasm
file once and be able to use rdkit from any path.Beta Was this translation helpful? Give feedback.
All reactions