Merge pull request #1 from Bouncey/feat/monacoEditor

Feat/monaco editor
This commit is contained in:
Stuart Taylor
2018-04-08 21:04:30 +01:00
committed by Mrugesh Mohapatra
parent 939028df20
commit 1f5abb3dde
13 changed files with 192 additions and 159 deletions

View File

@ -1,4 +1,6 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { dasherize } = require('./utils');
const { viewTypes } = require('./utils/challengeTypes');
const { blockNameify } = require('./utils/blockNameify');
@ -84,3 +86,27 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
);
});
};
exports.modifyWebpackConfig = ({ config, stage, babelConfig }) => {
if (stage === 'build-javascript' || stage === 'develop') {
config.plugin('CopyWebpackPlugin', CopyWebpackPlugin, [
[
{
from: path.resolve(__dirname, './node_modules/monaco-editor/min/vs'),
to: 'vs'
}
]
]);
// 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;
};