-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Uncaught TypeError: fs.readFileSync is not a function #7384
Comments
Just found a relevant discussion on Meteor forums, but the solution is still unknown. |
It appears that the issue I'm facing is sourcing from this file: mapbox-gl-shaders/index.js. It is expected to be processed by webpack and turned into a single file where occurances of Meteor does not seem to be able to process such a thing. Any ways to overcome the problem with the current build system? I could have tried to just use a dist version of |
Another interesting thing is seeing |
I think we are also seeing this similar error with fs using another npm package... on the browser console we see function not defined errors. I think the meteor-node-stubs just gives you an empty object for 'fs' so I think that is why it happens. Previously we used meteorhacks:npm to install the package and cosmos:browserify to use the package on the client side. However as we are currently trying to migrate to Meteor 1.3/1.4 we were hoping to ditch both these packages and just use the native npm... From the Meteor guide it seems that we should just be able to do an import on both client and server without problems but obviously in our previous method some more magic was being conducted which has now dropped out of our build process... |
@kachkaev any luck to get fs.readFileSync working on the client side? facing the same thing here! |
I ended up switching to webpack where I was able to configure a transform when loading mapbox js files. fs.readFileSync is now executed during build so the browser gets the result of this function, not the function call itself. Maybe this thread of a few neighbouring ones can help you: mapbox/mapbox-gl-js#1649 |
Closing for a similar reason as #7567, but mostly because the discussion in #6890 is the closest thing to a more generic, actual solution for this (rather than having individual issues about NPM modules that don't work). And from #7567:
|
I'm trying to use
meteor npm install
react-map-gl
and end up with this fatal error in a browser:My guess is that the issue is somehow related to the way meteor mocks nodes's
fs
methods. I've addedmeteor-node-stubs
to my localnode_modules
, but this did not help.I understand that using
fs.readFileSync
on a client is odd, but assume that there is a reason for referencing this method. It does not seem to cause problems in apps that are built not with meteor, so I guess we should not move the issue upstream.Trying everything on Meteor 1.4-beta.9. Any ideas on a temporal workaround?
The text was updated successfully, but these errors were encountered: