Skip to content

Instantly share code, notes, and snippets.

@novemberborn

novemberborn/.babelrc

Last active Jan 13, 2018
Embed
What would you like to do?
{
plugins: [
['./plugin', {label: 'plugin'}],
['./plugin', {label: 'plugin'}, 'named']
],
overrides: [
{
test: 'foo.js',
extends: './extends.json5',
plugins: [
['./plugin', {label: 'override'}, 'named']
],
}
]
}
node_modules
// npx babel bar.js
[]
{
plugins: [
['./plugin', {label: 'extends'}],
['./plugin', {label: 'extends'}, 'named']
],
overrides: [
{
test: 'foo.js',
plugins: [
['./plugin', {label: 'extends.override'}, 'named']
],
}
]
}
// npx babel foo.js
[]
{
"name": "fdf830ce929a8641651f7838ea4efab1",
"version": "1.0.0",
"description": "",
"main": "foo.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gist.github.com/fdf830ce929a8641651f7838ea4efab1.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://gist.github.com/fdf830ce929a8641651f7838ea4efab1"
},
"homepage": "https://gist.github.com/fdf830ce929a8641651f7838ea4efab1",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.37",
"@babel/core": "^7.0.0-beta.37"
}
}
module.exports = babel => {
return {
visitor: {
ArrayExpression (path, state) {
const node = path.node
node.elements.push(babel.types.stringLiteral(state.opts.label))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment