takuyaa / kuromoji.js

JavaScript implementation of Japanese morphological analyzer
832 stars 117 forks source link

Fix resolution on Atom editor #8

Closed azu closed 8 years ago

azu commented 8 years ago

@takuyaa Hi, I fixed require("kuromoji"); // undefeined issue on some env like Atom.

Purpose

Currently, kuromoji.js doesn't work on Atom editor(plugin). This pull request fix this issue.

require("kuromoji"); // undefeined in Atom.

Changes

Atom has window object... it means that module.exports = undefined @ src/kuromoji.js

I refactor this feature detection and move feature detection to browserify's build phase. (So, feature detection code was removed)

I'v added a macro that replace NodeDictionaryLoader to BrowserDictionaryLoader into gulpfile.js and package.json

takuyaa commented 8 years ago

Thanks a lot @azu This is pretty good PR and some tests on my browsers work well. I never known about browser field, but it seems to be suitable in this situation.

I have a question or comment on this point. I'd like to get your opinion about that.

azu commented 8 years ago

Thanks! I can't wait for new release!