jieba-wasm
jieba-wasm copied to clipboard
Cannot read properties of undefined (reading '__wbindgen_add_to_stack_pointer')
I get this error when trying to use the project within a vuejs project. Do you know what could cause this?
same problem
same problem
Use this to init before calling functions.
For example in react.
import init, { cut } from "jieba-wasm/pkg/web/jieba_rs_wasm.js";
export default function TestJieba(): JSX.Element {
useEffect(() => {
init("https://cdn.jsdelivr.net/npm/jieba-wasm@latest/pkg/web/jieba_rs_wasm_bg.wasm");
}, []);
function cutTest(text) {
const cutWords = cut(text);
console.log(cutWords);
}
}
We should call init method to load the wasm file before to call other method in browser.
I have created a pull request https://github.com/fengkx/jieba-wasm/pull/4 to show usage in browser.
Fixes By #4