Using Relay Modern & Expo with babel-plugin-relay

I’m trying to get a project up and running with Relay Modern, and get the following error

The package at "node_modules/babel-plugin-relay/lib/getDocumentName.js" attempted to import the Node standard library module "path". It failed because React Native does not include the Node standard library. Read more at

I’ve read the docs at , and my .babelrc looks like this

  "presets": [
    { "plugins": ["./node_modules/babel-plugin-relay"] }
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]

I’ve gone through various docs on the Relay site and elsewhere, and nothing gets around this. Is there a particular Relay plugin, which is not babel-plugin-relay, which avoids using Node standard library, which I should be using?

1 Like

it’s strange that code that is attempting to require the path module is making it into the bundle that is loaded by react-native. can you inspect the bundle and see where that’s coming from? the error message you’re getting is a more helpful version (usually) of “Unable to resolve “path” from …” when you try to do const path = require('path') and path is not available in your project (

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.