dqbd / tiktoken

JS port and JS/WASM bindings for openai/tiktoken
MIT License
649 stars 49 forks source link

Create React App: Unhandled Rejection (TypeError): wasm.__wbindgen_add_to_stack_pointer is not a function #21

Closed xiaohuoni closed 1 year ago

xiaohuoni commented 1 year ago

image

use webpack 5

asyncWebAssembly: true,
      layers: true,
      topLevelAwait: true,
nnmrts commented 1 year ago

Please reopen this, still an issue.

dqbd commented 1 year ago

As far as I understand, the issue is contained within Create React App, is that the case @nnmrts?

dqbd commented 1 year ago

@nnmrts Please follow these instructions to enable WASM support in CRA via @craco/craco:

https://github.com/dqbd/tiktoken/tree/main/js#create-react-app

nnmrts commented 1 year ago

As far as I understand, the issue is contained within Create React App, is that the case @nnmrts?

@dqbd No, I have this exact problem when using the chatgpt module through https://esm.sh/chatgpt with Deno, not using CRA at all. :/

I can provide more details later, but yeah, this is not just an issue with CRA.

dqbd commented 1 year ago

For Deno (Deploy) there is an existing issue #22