Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
babel-relay-plugin-loader-0.9
Advanced tools
This is a workaround to be able to use the Babel Relay Plugin in .babelrc and using babel-node.
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.
This workaround enables us to use the Babel Relay Plugin in .babelrc
without breaking babel-node
.
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.
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 ;)
Please contribute and let me know once this workaround is not needed anymore.
FAQs
This is a workaround to be able to use the Babel Relay Plugin in .babelrc and using babel-node.
The npm package babel-relay-plugin-loader-0.9 receives a total of 0 weekly downloads. As such, babel-relay-plugin-loader-0.9 popularity was classified as not popular.
We found that babel-relay-plugin-loader-0.9 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.