-
Notifications
You must be signed in to change notification settings - Fork 75
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
Problem using Elasticsearch #141
Comments
This really sounds like a webpack config issue to me, not something specific to this project. But anyway... What changes did you make to the webpack config, and what were the new error messages? |
Sorry, I take that back, you're right that this project should already contain webpack server config to ignore the |
Ok. If it's as easy as excluding "browser" the way I did above (using resolve.packageNames) then I'll have to see why that still wasn't working and report back here. |
Had this same problem with elasticsearch in a different repo. Landed here, posted for anyone else who makes it here too. All you have to do is add
|
I think this might be a webpack configuration issue but I'm not exactly sure.
The Problem
I cloned the repo fresh, ran
npm install elasticsearch --save
and placedimport {Client} from 'elasticsearch'
in themain_server.js
file.Running that I get an error about
navigator
not found. This error is an Elasticsearch error from theirxhr.js
file. It's looking for stuff that's not available on the server (ie. navigator and window). I traced it further and found that that file is really for the browser, not server. I believe it's getting included because the Elasticsearch npm package uses the "browser" directive in it'spackage.json
file. This is an excerpt of that file:The "browser" field spec is here: https://github.com/defunctzombie/package-browser-field-spec
You can actually tell webpack to ignore or include certain fields in package.json as explained here: https://webpack.github.io/docs/configuration.html#resolve-packagemains
Fix Attempt
So I tried adding that clause to my webpack server configuration telling it to ignore "browser" but that causes a bunch of other things to break.
Further Testing
To make sure that this isn't a Meteor/Elasticsearch problem I created a new Meteor (1.3) app, installed Elasticsearch and put the include in the server code. That worked fine so I guess the Meteor 1.3 npm code is importing the package properly.
Question
Does anyone have any insight as to what's going on here? When Elasticsearch gets included on the server it seems to be thinking it's on the browser.
The text was updated successfully, but these errors were encountered: