Last active
January 13, 2018 15:43
-
-
Save novemberborn/fdf830ce929a8641651f7838ea4efab1 to your computer and use it in GitHub Desktop.
Overrides through extends — https://github.com/babel/babel/pull/7091#issuecomment-357444478
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
plugins: [ | |
['./plugin', {label: 'plugin'}], | |
['./plugin', {label: 'plugin'}, 'named'] | |
], | |
overrides: [ | |
{ | |
test: 'foo.js', | |
extends: './extends.json5', | |
plugins: [ | |
['./plugin', {label: 'override'}, 'named'] | |
], | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npx babel bar.js | |
[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
plugins: [ | |
['./plugin', {label: 'extends'}], | |
['./plugin', {label: 'extends'}, 'named'] | |
], | |
overrides: [ | |
{ | |
test: 'foo.js', | |
plugins: [ | |
['./plugin', {label: 'extends.override'}, 'named'] | |
], | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npx babel foo.js | |
[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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