mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const { ModuleFederationPlugin } = require('webpack').container;
|
|
const path = require('path');
|
|
|
|
const deps = require('./package.json').dependencies;
|
|
|
|
module.exports = {
|
|
entry: './src/index',
|
|
mode: 'development',
|
|
devServer: {
|
|
contentBase: path.join(__dirname, 'dist'),
|
|
port: 3001,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /bootstrap\.js$/,
|
|
loader: 'bundle-loader',
|
|
options: {
|
|
lazy: true,
|
|
},
|
|
},
|
|
{
|
|
test: /\.jsx?$/,
|
|
loader: 'babel-loader',
|
|
exclude: /node_modules/,
|
|
options: {
|
|
presets: ['@babel/preset-react'],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new ModuleFederationPlugin({
|
|
name: 'lowdefy_renderer',
|
|
library: { type: 'var', name: 'lowdefy_renderer' },
|
|
filename: 'remoteEntry.js',
|
|
exposes: {
|
|
'./Engine': './src/Engine',
|
|
},
|
|
shared: {
|
|
...deps,
|
|
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
|
|
},
|
|
'react-dom': {
|
|
singleton: true, // only a single version of the shared module is allowed
|
|
},
|
|
},
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
template: './public/index.html',
|
|
}),
|
|
],
|
|
};
|