Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index file to fix includes require problems with nodejs #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polo2ro
Copy link

@polo2ro polo2ro commented Dec 11, 2016

I got some problems with nodejs and the migration from npm 2 to npm 3. This is a proposal to fix the issue, with for example:

const lunrLanguages = require('lunr-languages');
...
lunrLanguages.stemmer(lunr);
lunrLanguages.fr(lunr);

npm 2 and npm 3 do not host file at the same place so direct use of require() is not possible

@MihaiValentin
Copy link
Owner

Hi @polo2ro and thanks a lot for proposing this MR!

Adding all the languages in a single index file seems a nice idea, but generally lunr and lunr-languages usecase is to use a single language, depending of the locale of the project.

IIRC requiring lunar-languages/index.js will automatically import ALL the languages, which would add quite some bloat.

Regarding npm version, can you please detail the problem? Thanks!

@polo2ro
Copy link
Author

polo2ro commented Feb 6, 2017

Hi,
The root problem is the compatibility with npm 2 and 3 because folder structure has been modified. My project was build with npm 2, then i deleted my node_modules folder and install with npm v3

here is a commit in my project where i changed the code compatible with npm 2 : polo2ro/hexo-generator-lunr@deee214#diff-b58e2f1cee2acff55355343774e6d576

Here is the npm doc where the new folder structure is explained:
https://docs.npmjs.com/how-npm-works/npm3

with npm2 the structure was:

  • myproject
    • hexo-generator-lunr
      • lunr-languages

with npm3 the structure is:

  • myproject
    • hexo-generator-lunr
    • lunr-languages

Let me know if i can work on this the way you want it. maybe i can return an object with some loading functions for each languages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants