forked from module-federation/module-federation-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
48 lines (42 loc) · 1.25 KB
/
webpack.config.js
File metadata and controls
48 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const { ModuleFederationPlugin } = require('webpack').container;
// @TODO: uncomment this if you want to dev on the Rust src code.
// const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const dist = path.resolve(__dirname, 'dist');
module.exports = {
entry: {
index: './public/index.js',
},
output: {
path: dist,
filename: '[name].js',
},
devServer: {
port: 8081,
static: {
directory: path.join(__dirname, 'dist'),
},
headers: {
'Access-Control-Allow-Origin': 'http://localhost:8080',
},
},
experiments: { asyncWebAssembly: true },
plugins: [
new CopyPlugin([path.resolve(__dirname, 'public')]),
// @TODO: uncomment this if you want to dev on the Rust src code.
// Webpack will load the Rust code and compile it to Wasm using Wasm-Pack.
// Wasm-pack will also generate all the JS bindings needed to interop with JS,
// found in the `./pkg` directory.
// new WasmPackPlugin({
// crateDirectory: __dirname,
// }),
new ModuleFederationPlugin({
name: 'GameOfLifeModule',
filename: 'remoteEntry.js',
exposes: {
'./GameOfLifeModule': './pkg/',
},
}),
],
};