89 lines
2.0 KiB
JavaScript
89 lines
2.0 KiB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const { ModuleFederationPlugin } = require('webpack').container;
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: './src/index.tsx',
|
|
devServer: {
|
|
port: 3000,
|
|
historyApiFallback: true,
|
|
static: {
|
|
directory: './public',
|
|
},
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
},
|
|
},
|
|
output: {
|
|
publicPath: '/',
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx|ts|tsx)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: [
|
|
'@babel/preset-react',
|
|
'@babel/preset-typescript',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new ModuleFederationPlugin({
|
|
name: 'shell',
|
|
remotes: {
|
|
demo: 'demo@http://localhost:3001/remoteEntry.js',
|
|
kms: 'kms@http://localhost:3002/remoteEntry.js',
|
|
faas: 'faas@http://localhost:3003/remoteEntry.js',
|
|
},
|
|
shared: {
|
|
react: {
|
|
singleton: true,
|
|
requiredVersion: '^18.2.0',
|
|
eager: true,
|
|
},
|
|
'react-dom': {
|
|
singleton: true,
|
|
requiredVersion: '^18.2.0',
|
|
eager: true,
|
|
},
|
|
'@mantine/core': {
|
|
singleton: true,
|
|
requiredVersion: '^7.0.0',
|
|
eager: true,
|
|
},
|
|
'@mantine/hooks': {
|
|
singleton: true,
|
|
requiredVersion: '^7.0.0',
|
|
eager: true,
|
|
},
|
|
'@mantine/notifications': {
|
|
singleton: true,
|
|
requiredVersion: '^7.0.0',
|
|
eager: true,
|
|
},
|
|
'@tabler/icons-react': {
|
|
singleton: true,
|
|
requiredVersion: '^2.40.0',
|
|
eager: true,
|
|
},
|
|
},
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
template: './public/index.html',
|
|
}),
|
|
],
|
|
}; |