takuyaa / kuromoji.js

JavaScript implementation of Japanese morphological analyzer
848 stars 118 forks source link

can't resolve path . #46

Closed DhansAL closed 3 years ago

DhansAL commented 3 years ago

Module not found: Error: Can't resolve 'path' in \node_modules\kuromoji\src\loader. I'm using react webpack and nodeJs

larvata commented 3 years ago

The main entry in the package.json is for nodejs. To use the browser version you should add the following config to your webpack.config

  resolve: {
    alias: {
      kuromoji$: 'kuromoji/build/kuromoji.js',
    },
  },