diff --git a/webpack.common.config.js b/webpack.common.config.js index 4f7f6110b76b..97c9153644a4 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -26,6 +26,44 @@ var defineFooter = new RegExp('(' + defineCallFooter.source + ')|(' + defineDirectFooter.source + ')|(' + defineFancyFooter.source + ')', 'm'); +var workerConfig = function() { + try { + return { + webworker: { + target: 'webworker', + context: __dirname, + entry: require('../workers.json'), + output: { + filename: '[name].js', + path: path.resolve(__dirname, 'common/static/bundles') + }, + plugins: [ + new BundleTracker({ + path: process.env.STATIC_ROOT_LMS, + filename: 'webpack-worker-stats.json' + }) + ], + module: { + rules: [ + { + test: /\.(js|jsx)$/, + include: [ + /node_modules\/@edx/ + ], + use: 'babel-loader' + } + ] + }, + resolve: { + extensions: ['.js'] + } + } + } + } catch (err) { + return null; + } +}; + module.exports = Merge.smart({ web: { context: __dirname, @@ -387,37 +425,6 @@ module.exports = Merge.smart({ fs: 'empty' } - }, - webworker: { - target: 'webworker', - context: __dirname, - entry: { - edx_proctoring_proctortrack: './node_modules/edx-proctoring-proctortrack/edx_proctoring_proctortrack/static/proctortrack_custom.js' - }, - output: { - filename: '[name].js', - path: path.resolve(__dirname, 'common/static/bundles') - }, - plugins: [ - new BundleTracker({ - path: process.env.STATIC_ROOT_LMS, - filename: 'webpack-worker-stats.json' - }) - ], - module: { - rules: [ - { - test: /\.(js|jsx)$/, - include: [ - /node_modules\/@edx/ - ], - use: 'babel-loader' - } - ] - }, - resolve: { - extensions: ['.js'] - } } -}, {web: xmoduleJS}); +}, {web: xmoduleJS}, workerConfig()); diff --git a/webpack.dev.config.js b/webpack.dev.config.js index afe8f302c55d..913d773caca3 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -59,10 +59,5 @@ module.exports = _.values(Merge.smart(commonConfig, { watchOptions: { ignored: [/node_modules/, /\.git/] } - }, - webworker: { - entry: { - mockprock: './node_modules/@edx/mockprock/static/index.js', - } } }));