Skip to content

Commit

Permalink
Webpack config will pull in available workers dynamically from edx-pr…
Browse files Browse the repository at this point in the history
…octoring
  • Loading branch information
Dave St.Germain committed Dec 21, 2018
1 parent 73213c7 commit b3a85ae
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 37 deletions.
71 changes: 39 additions & 32 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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());

5 changes: 0 additions & 5 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
}
}));

0 comments on commit b3a85ae

Please sign in to comment.