Socket
Socket
Sign inDemoInstall

babel-plugin-relay

Package Overview
Dependencies
47
Maintainers
9
Versions
3421
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-relay

A Babel Plugin for use with Relay applications.


Version published
Weekly downloads
143K
decreased by-8.56%
Maintainers
9
Install size
3.96 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-relay

Relay requires a Babel plugin to convert GraphQL tags to runtime artifacts.

A very simplified example of what this plugin is doing:

// It converts this code
const fragment = graphql`
  fragment User_fragment on User {
    name
  }
`;

// To require generated ASTs for fragments and queries
const fragment = require('__generated__/User_fragment.graphql');

Plugin Configuration

babel-plugin-relay will discover the config if:

  • There is a relay.config.json, relay.config.js file at the root of the project (i.e. in the same folder as the package.json file).
  • The package.json file contains a "relay" key.

Supported configuration options for babel-plugin-relay

  • artifactDirectory A specific directory to output all artifacts to. When enabling this the babel plugin needs artifactDirectory to be set as well. [string]
  • eagerEsModules This option enables emitting ES modules artifacts. [boolean][default: false]
  • codegenCommand The command to run to compile Relay files. [string]
  • isDevVariableName Name of the global variable for dev mode (e.g. __DEV__). [string]
  • jsModuleFormat Formatting style for generated files. commonjs or haste. Default is commonjs. [string]

Configuration Instructions

Keywords

FAQs

Last updated on 23 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc