-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.config.js
68 lines (63 loc) · 1.77 KB
/
webpack.config.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const webpack = require("webpack");
const { join } = require("path");
const { ESBuildPlugin } = require("esbuild-loader");
const outputDir = join(__dirname, ".next/static/chunks/modfed");
const publicPath = "/_next/static/chunks/modfed/";
const mode = "production";
const output = {
filename: "[name].[contenthash].js",
chunkFilename: "[name].[contenthash].js",
path: outputDir,
publicPath: publicPath,
};
const alias = {
react: "preact/compat",
"react-dom": "preact/compat",
"~": __dirname,
};
const esbuild = {
rules: [
{
test: /\.[tj]sx?$/,
use: [
{
loader: "esbuild-loader",
options: {
loader: "tsx", // Or 'ts' if you don't need tsx
target: "es2017",
},
},
],
},
],
};
module.exports = () => {
return [
{
name: "modfed-entry",
entry: {
bootstrap: "./modfed/bootstrap",
},
output: output,
module: esbuild,
devtool: "source-map",
mode,
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
alias: alias,
},
stats: {},
plugins: [
new ESBuildPlugin(),
// new webpack.container.ModuleFederationPlugin({
// name: "modfed-entry",
// // List of remotes with URLs
// // remotes: remotes,
//
// // list of shared modules from shell
// shared: ["react", "react-dom", "joi", "formik"],
// }),
],
},
];
};