MihaiValentin / lunr-languages

A collection of languages stemmers and stopwords for Lunr Javascript library
Other
430 stars 163 forks source link

nodejieba (Chinese) is not working with webpack #75

Closed UMTERPS closed 3 years ago

UMTERPS commented 3 years ago

When using webpack and lurn.zh, it will results in:

TypeError: nodejieba.cut is not a function
    at lunr.Builder.lunr.zh.tokenizer (webpack://test/./node_modules/lunr-languages/lunr.zh.js?:92:17)
    at lunr.Builder.add (webpack://test/./node_modules/lunr/lunr.js?:2479:23)
    ....

It seems that nodejieba is minimized by webpack and "cut" is no longer a valid function name.

I've tried:

 optimization: {
    minimize: false
  }

But it didn't resolve the issue. Still trying to figure out a solution...

1921Aaron commented 1 year ago

May I ask how you solved it?