diff --git a/packages/learn/gatsby-node.js b/packages/learn/gatsby-node.js
index 67c6de47047..9d0d0468316 100644
--- a/packages/learn/gatsby-node.js
+++ b/packages/learn/gatsby-node.js
@@ -83,8 +83,26 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
});
};
-exports.modifyWebpackConfig = ({ config, stage, babelConfig }) => {
- if (stage === 'build-javascript' || stage === 'develop') {
+const generateBabelConfig = require('gatsby/dist/utils/babel-config');
+
+exports.modifyWebpackConfig = ({ config, stage }) => {
+ const program = {
+ directory: __dirname,
+ browserslist: ['> 1%', 'last 2 versions', 'IE >= 9']
+ };
+
+ return generateBabelConfig(program, stage).then(babelConfig => {
+ config.removeLoader('js').loader('js', {
+ test: /\.jsx?$/,
+ exclude: modulePath => {
+ return (
+ /node_modules/.test(modulePath) &&
+ !(/node_modules\/(ansi-styles|chalk)/).test(modulePath)
+ );
+ },
+ loader: 'babel',
+ query: babelConfig
+ });
config.plugin('CopyWebpackPlugin', CopyWebpackPlugin, [
[
{
@@ -93,16 +111,5 @@ exports.modifyWebpackConfig = ({ config, stage, babelConfig }) => {
}
]
]);
- // remove the default 'js' loader so we can create our own
- config.removeLoader('js');
- // these modules are shipped with es6 code, we need to transform them due
- // to the version of the uglifyjs plugin gatsby is using
- config.loader('js', {
- test: /\.jsx?$/,
- exclude: /(node_modules|bower_components)\/(?!ansi-styles|chalk)/,
- loader: 'babel',
- query: babelConfig
- });
- }
- return config;
+ });
};
diff --git a/packages/learn/gatsby-ssr.js b/packages/learn/gatsby-ssr.js
index ede5d71f75c..31853c49cec 100644
--- a/packages/learn/gatsby-ssr.js
+++ b/packages/learn/gatsby-ssr.js
@@ -16,3 +16,12 @@ exports.replaceRenderer = ({
);
replaceBodyHTMLString(renderToString());
};
+
+exports.onRenderBody = ({ setPostBodyComponents }) =>
+ setPostBodyComponents([
+
+ ]);
diff --git a/packages/learn/src/client/frame-runner.js b/packages/learn/src/client/frame-runner.js
index 15a36d10a01..c05d6357ae5 100644
--- a/packages/learn/src/client/frame-runner.js
+++ b/packages/learn/src/client/frame-runner.js
@@ -2,12 +2,18 @@ document.addEventListener('DOMContentLoaded', function() {
var testTimeout = 5000;
var Rx = document.Rx;
var frameReady = document.__frameReady;
- var helpers = Rx.helpers;
- var chai = require('chai');
+ var chai = parent.chai;
var source = document.__source;
var __getUserInput = document.__getUserInput || (x => x);
var checkChallengePayload = document.__checkChallengePayload;
+ function isPromise(value) {
+ return (
+ value &&
+ typeof value.subscribe !== 'function' &&
+ typeof value.then === 'function'
+ );
+ }
// Fake Deep Equal dependency
/* eslint-disable no-unused-vars */
const DeepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
@@ -105,7 +111,7 @@ document.addEventListener('DOMContentLoaded', function() {
// sync tests can return Any type
__result = test(getUserInput);
- if (helpers.isPromise(__result)) {
+ if (isPromise(__result)) {
// turn promise into an observable
__result = Rx.Observable.fromPromise(__result);
}
diff --git a/packages/learn/src/templates/Challenges/utils/ajax-stream.js b/packages/learn/src/templates/Challenges/utils/ajax-stream.js
index 534d2a0b4c6..d82896ca14b 100644
--- a/packages/learn/src/templates/Challenges/utils/ajax-stream.js
+++ b/packages/learn/src/templates/Challenges/utils/ajax-stream.js
@@ -17,7 +17,7 @@
*/
import debugFactory from 'debug';
-import { Observable, helpers } from 'rxjs';
+import { Observable, noop } from 'rxjs';
const debug = debugFactory('fcc:ajax$');
const root = typeof window !== 'undefined' ? window : {};
@@ -42,7 +42,7 @@ function getXMLHttpRequest() {
}
} catch (e) {
// purposely do nothing
- helpers.noop(e);
+ noop.noop(e);
}
}
return new root.ActiveXObject(progId);