Closed ghost closed 1 year ago
Hello @ameywtf, please try the newest latest version (1.0.0
), which should resolve the bundling issues.
I had a similar issue as OP, so I tried upgrading to latest (1.0.2).
I couldn't get the module resolution to work on Edge runtime when I tried importing the wasm file:
import wasm from '@dqbd/tiktoken/lite/tiktoken_bg.wasm?module';
Module not found: Package path ./lite/tiktoken_bg.wasm?module is not exported from package /<project>/node_modules/@dqbd/tiktoken (see exports field in /<project>/node_modules/@dqbd/tiktoken/package.json)
However, when I switched to relative path (similar to Cloudflare Workers setup), it worked:
// src/pages/api/<route>.ts
import wasm from '../../../node_modules/@dqbd/tiktoken/lite/tiktoken_bg.wasm?module';
In the end, I made a local copy of tiktoken_bg.wasm so that I don't have to rely on node_modules.
I had a similar problem at verstion 1.0.2
March 3,2023, was the last time I compiled successfully .That verstion 0.4.0
Even i rolled back tov0.4.0
and got the same result
2023-3-19 14:20:44
verstion 1.0.2
I resolved it by copy tiktoken_bg.wasm
to my dist
directory
The issue should be fully resolved with 1.0.4.
I added the package using yarn add but this error won't go away, tried using npm but still persists