babel-preset-gatsby
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.1.7](https://github.com/gatsbyjs/gatsby/compare/babel-preset-gatsby@0.1.6...babel-preset-gatsby@0.1.7) (2019-02-06) | ||
### Bug Fixes | ||
- **babel-preset-gatsby:** Show a helpful error when used in the wrong environment ([#11555](https://github.com/gatsbyjs/gatsby/issues/11555)) ([adf06e5](https://github.com/gatsbyjs/gatsby/commit/adf06e5)) | ||
<a name="0.1.6"></a> | ||
@@ -8,0 +14,0 @@ |
11
index.js
@@ -11,3 +11,12 @@ "use strict"; | ||
if (process.env.NODE_ENV !== `test`) { | ||
pluginBabelConfig = require(path.join(process.cwd(), `./.cache/babelState.json`)); | ||
try { | ||
pluginBabelConfig = require(path.join(process.cwd(), `./.cache/babelState.json`)); | ||
} catch (err) { | ||
if (err.message.includes(`Cannot find module`)) { | ||
// This probably is being used outside of the Gatsby CLI. | ||
throw Error(`\`babel-preset-gatsby\` has been loaded, which consumes config generated by the Gatsby CLI. Set \`NODE_ENV=test\` to bypass, or run \`gatsby build\` first.`); | ||
} else { | ||
throw err; | ||
} | ||
} | ||
} | ||
@@ -14,0 +23,0 @@ |
{ | ||
"name": "babel-preset-gatsby", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"author": "Philipp Spiess <hello@philippspiess.com>", | ||
@@ -23,3 +23,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "805956e1c7d2d4fc9ba6816d993a23b709fa50d9" | ||
"gitHead": "300ae709e85084ae9145360fed9b76290ae12f2a" | ||
} |
7322
51