Skip to content

Instantly share code, notes, and snippets.

@novemberborn
Last active January 13, 2018 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save novemberborn/fdf830ce929a8641651f7838ea4efab1 to your computer and use it in GitHub Desktop.
Save novemberborn/fdf830ce929a8641651f7838ea4efab1 to your computer and use it in GitHub Desktop.
{
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