-
Notifications
You must be signed in to change notification settings - Fork 147
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
Error when using from react #64
Comments
Stumbled upon this as well - webpack in general doesen't like expression dependencies. Just changing: to seems to do the trick |
Doesn't appear to me that this was ever resolved |
@jlandersen the fix suggested by you worked! Background: I am trying to use npm kafka-node in a React web app. (kafka-node has an internal dependency on node-zookeeper-client.) |
I see the error message
Error: Cannot find module "."
when trying to run a react app which includesnode-zookeeper-client
. The error occurs on line 776 when trying torequire
the specification file,./specification.json
. This file doesn't exist in the code bundled by webpack. I'm usingnode-zookeeper-client
as a transitive dependency ofzoologist
.A potential fix: if
specification.json
wasspecification.js
and exported the json as a var then the import would work. I've tried this. Happy to put in a PR if you'd like me to. I could probably work around this with some webpack changes but: 1) at the moment the dependency fails when used from react and you probably don't want this and 2) I might have to 'eject' the app from the cradle ofcreate-react-app
and I'd rather not do that for this reason.Steps to reproduce (I'm using yarn here but the steps could easily be npm):
$ create-react-app node-zookeeper-client_react_test
create-react-app
version 1.3.1.$ cd node-zookeeper-client
$ yarn add node-zookeeper-client
src/App.js
and addvar zookeeper = require('node-zookeeper-client');
below the imports. (Using an import produces the same error).$ yarn start
and let it open the app's root pageThe text was updated successfully, but these errors were encountered: