Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-react-relay

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-relay

Babel plugin for Relay (react-relay) with easy schema configuration in .babelrc

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
increased by9.68%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-react-relay npm version

Babel plugin for Relay with support for multiple source types

How does this relate to babel-relay-plugin?

This package uses babel-relay-plugin internaly but makes usage more convenient and extends its functionality. For example you no longer need to have a build/babelRelayPlugin.js script.

Install

$ npm install -D babel-plugin-react-relay

Configuration

Step 1: Add babel plugin

Add the following to your .babelrc file or the corresponding babel configuration.

{
	"plugins": ["react-relay"]
}

Step 2: Configure schema source

Add one the following source options to your package.json file.

JSON

Imports a static GraphQL schema exported as a JSON file

{
  "react-relay-schema": "./exported-schema.json"
}
URL

You can also provide an URL to a schema endpoint. Use this method if you're using graph.cool.

{
  "react-relay-schema": "http://localhost:3000/schema.json"
}
Schema

graphql-js schema definition are also supported.

{
  "react-relay-schema": "./schema-definition.js"
}

Options

Environment Variables

Sometimes you need the flexibility to dynamically configure your GraphQL schema source via environment variables. You can easily to that using the following syntax (works for all source types):

{
  "react-relay-schema": {
	"env": "SCHEMA_ENDPOINT"
  }
}

This example uses the $SCHEMA_ENDPOINT environment variable.

License

MIT License

Keywords

FAQs

Package last updated on 20 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc