Skip to content

Commit 75574bf

Browse files
authored
Merge pull request #158 from renanpvaz/improve-adblocker-related-error-message
Mention ad blockers when Babel is not defined
2 parents 361e27c + 26c975d commit 75574bf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/CodeEditor/CodeEditor.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,16 @@ class CodeEditor extends Component {
197197
color: colors.error,
198198
padding: 10,
199199
}}>
200-
{error.message}
200+
{this.state.didBabelLoad ? (
201+
error.message
202+
) : (
203+
<span>
204+
Babel could not be loaded. This can be caused by ad
205+
blockers. If you're using an ad blocker, consider adding
206+
reactjs.org to the whitelist so the live code examples
207+
will work.
208+
</span>
209+
)}
201210
</pre>
202211
</div>
203212
)}
@@ -305,6 +314,7 @@ class CodeEditor extends Component {
305314
console.error(error);
306315

307316
return {
317+
didBabelLoad: !!window.Babel,
308318
compiled: null,
309319
error,
310320
};

0 commit comments

Comments
 (0)