lindera-wasm-jieba-bundler is a specialized npm package that provides a WebAssembly-based morphological analysis library for Chinese language text, specifically utilizing the Jieba dictionary. It is part of the Lindera project, which offers high-performance text segmentation by compiling Rust code to WebAssembly. The current stable version series is `3.x`, with `3.0.5` being the latest release, focusing on safety and refactoring. This particular package is optimized for use within JavaScript bundler environments like Webpack or Rollup, providing a compact and efficient solution for client-side or server-side (via bundlers) Chinese text processing. Lindera's key differentiators include its Rust-based performance, WASM portability across various JavaScript runtimes (browser, Node.js via bundlers), and its modular approach with separate packages for different dictionaries and target environments (web, nodejs, bundler). Release cadence appears to be active, with several minor updates within the 3.0.x series recently.
npm install lindera-wasm-jieba-bundlerVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize the Lindera WASM module, build a tokenizer with the embedded Jieba dictionary, and perform morphological analysis on Chinese text in a bundler environment.
Review the `README.md` for the correct package suffix (`-web`, `-nodejs`, `-bundler`) matching your environment. For Node.js, `lindera-nodejs` is a separate native NAPI-RS binding, and WASM targets for Node.js were deprecated.
Ensure you are using the correct package for your environment: `lindera-wasm-<dictionary>-web` for direct browser usage via `<script type="module">`, `lindera-wasm-<dictionary>-nodejs` for Node.js (pre-v3.0.0 WASM, or NAPI-RS for v3.0.0+ `lindera-nodejs`), and `lindera-wasm-<dictionary>-bundler` for projects using bundlers like Webpack or Rollup.
Always prepend `await __wbg_init();` at the beginning of your asynchronous function where you use Lindera, ensuring the WASM module is fully loaded and ready.
For `lindera-wasm-jieba-bundler`, always use `builder.setDictionary("embedded://jieba")`. Refer to the package name and documentation for the correct dictionary identifier.Ensure you have `await __wbg_init();` called before attempting to instantiate `TokenizerBuilder`.
Verify that `builder.setDictionary("embedded://jieba")` is used for the `lindera-wasm-jieba-bundler` package. Other dictionary names will not work.Switch to ES module `import` statements (e.g., `import { TokenizerBuilder } from 'lindera-wasm-jieba-bundler';`) and ensure your build environment supports ESM.No dependency data recorded yet.