How to use the container function from webpack

Find comprehensive JavaScript webpack.container code examples handpicked from public code repositorys.

24
25
26
27
28
29
30
31
32
33
output: {
  filename: 'feature-app.federated.js',
  publicPath: '/',
},
plugins: [
  new webpack.container.ModuleFederationPlugin({
    name: '__feature_hub_feature_app_module_container__',
    exposes: {
      featureAppModule: path.join(__dirname, './feature-app'),
    },
fork icon23
star icon144
watch icon14

+ 3 other calls in file

2
3
4
5
6
7
8
9
10
11
const path = require('path');
const crypto = require('crypto');
const { merge } = require('webpack-merge');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const { ModuleFederationPlugin } = webpack.container;
const sharedConfig = require('./webpack.shared.config.js');

// const getLocalIdent = (context, localIdentName, localName, options) => { // https://github.com/michalkvasnicak/babel-plugin-css-modules-transform/issues/103#issuecomment-681853153
//      const getHash = value => crypto.createHash('sha256').update(value).digest('hex');
fork icon2
star icon6
watch icon2

3
4
5
6
7
8
9
10
11
const exec = require('child_process').exec;
const path = require('path');

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const {ModuleFederationPlugin} = webpack.container;
const tsTransformer = require('@formatjs/ts-transformer');

const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-process-env
fork icon0
star icon0
watch icon0