Skip to content

Commit

Permalink
Allow use of babel options (gatsbyjs#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x80 authored and KyleAMathews committed Apr 20, 2017
1 parent b0ce38b commit 5d7bcdc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/gatsby/lib/utils/babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import apiRunnerNode from "./api-runner-node"
*
*/
function resolvePlugin(pluginName, directory, type) {
// When a plugin is specified with options in babelrc, the pluginName contains
// the array with [name, options]. In that case we extract the name.
pluginName = Array.isArray(pluginName) ? pluginName[0] : pluginName

const gatsbyPath = path.resolve(__dirname, `..`, `..`)
const plugin =
resolve(`babel-${type}-${pluginName}`, directory) ||
Expand All @@ -32,8 +36,9 @@ function resolvePlugin(pluginName, directory, type) {
? pluginName
: `babel-${type}-${pluginName}`
const pluginInvariantMessage = `
You are trying to use a Babel plugin which Gatsby cannot find. You
can install it using "npm install --save ${name}".
You are trying to use a Babel plugin or preset which Gatsby cannot find: ${pluginName}
You can install it using "npm install --save ${name}".
You can use any of the Gatsby provided plugins without installing them:
- babel-plugin-add-module-exports
Expand Down

0 comments on commit 5d7bcdc

Please sign in to comment.