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

babel-relay-plugin-loader-0.9

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-relay-plugin-loader-0.9

This is a workaround to be able to use the Babel Relay Plugin in .babelrc and using babel-node.

  • 0.9.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

babel-relay-plugin-loader

Versions

The current babel-relay-plugin-loader version 0.8.1 and 0.8.1-nologs is loading the babel-relay-plugin version 0.8.1.

The 0.8.1-nologs is only to keep the version number in sync with babel-relay-plugin and the -nologs tag should not be used with the next version anymore since it no console logs will be the default behaviour anyways then.

Overview

This workaround enables us to use the Babel Relay Plugin in .babelrc without breaking babel-node.

Description

The Babel Relay Plugin needs to be configured with a GraphQL schema. Usually you would do this locally in your project. Unfortunately there is an issue that does not allow local plugins to be used within .babelrc without breaking babel-node. You can find all the details here in #454.

Usage

Just npm install --save-dev babel-relay-plugin-loader and add the path to your schema.json to your projects package.json like this:

...
"metadata": {
  "graphql": {
    "schema": "./data/schema.json"
  }
},
...

This path should be relative to the location of your package.json.

Then you can add this plugin to your .babelrc file like this:

Babel 5

{
  "stage": 0,
  "env": {
    "development": {
      "plugins": ["babel-relay-plugin-loader", "react-transform"],
      "sourceMaps": "inline",
      "optional": [
          "runtime",
          "es7.decorators",
          "es7.classProperties"
        ],
      "extra": {
        "react-transform": {
          "transforms": [{
            "transform": "react-transform-hmr",
            "imports": ["react"],
            "locals": ["module"]
          }, {
            "transform": "react-transform-catch-errors",
            "imports": ["react", "redbox-react"]
          }]
        }
      }
    }
  }
}

Babel 6

{
  "presets": [
    "es2015",
    "react",
    "stage-0"
  ],
  "env": {
    "development": {
      "plugins": [
        "babel-relay-plugin-loader",
        [
          "react-transform",
          {
            "transforms": [
              {
                "transform": "react-transform-hmr",
                "imports": [
                  "react"
                ],
                "locals": [
                  "module"
                ]
              },
              {
                "transform": "react-transform-catch-errors",
                "imports": [
                  "react",
                  "redbox-react"
                ]
              }
            ]
          }
        ]
      ]
    },
    "production": {
      "plugins": [
        "babel-relay-plugin-loader"
      ]
    }
  }
}

And you are ready to go ;)

Contributions

Please contribute and let me know once this workaround is not needed anymore.

FAQs

Package last updated on 15 Nov 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