Files
frontend-app-learning/webpack.dev.config.js
David Joy 76a85224b8 Initial implementation of frontend plugins
Uses webpack 5 module federation to dynamically load code based on a JS file URL.
2021-02-09 17:22:00 -05:00

29 lines
987 B
JavaScript

const { createConfig } = require('@edx/frontend-build');
// eslint-disable-next-line import/no-extraneous-dependencies
const { ModuleFederationPlugin } = require('webpack').container;
module.exports = createConfig('webpack-dev', {
plugins: [
new ModuleFederationPlugin({
name: 'learning',
shared: {
react: {
import: 'react', // the "react" package will be used a provided and fallback module
shareKey: 'react', // under this name the shared module will be placed in the share scope
shareScope: 'default', // share scope with this name will be used
singleton: true, // only a single version of the shared module is allowed
eager: true,
},
'react-dom': {
singleton: true, // only a single version of the shared module is allowed
eager: true,
},
'@edx/frontend-platform': {
singleton: true,
eager: true,
},
},
}),
],
});