leizongmin / node-segment

基于Node.js的中文分词模块

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find module "URLTokenizer"

linonetwo opened this issue · comments

At

var filename = path.resolve(__dirname, 'module', module + '.js');
      if (!fs.existsSync(filename)) {

Where filename === "/module/URLTokenizer.js"

I'm importing it inside electron.

Can we change a way to load module?

Any chance to solve this?

I think requiring fs and path eliminate the usage in the browser.

I have an idea: just like what moment do, we can separate main script and plugin. Let user import and passing plugin to the main script.

In this way, we can enjoy the tree shaking, and keep the plugin architecture.