@module-federation/esbuild 0.0.0-next-20240524231356 → 0.0.0-next-20240528203231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -32
- package/dist/build.cjs.js +704 -29
- package/dist/build.esm.js +678 -4
- package/dist/esbuild.cjs.js +178 -176
- package/dist/esbuild.esm.js +178 -176
- package/dist/get-externals.cjs.js +20 -0
- package/dist/get-externals.esm.js +18 -0
- package/dist/src/adapters/lib/containerPlugin.d.ts +2 -1
- package/dist/src/adapters/lib/containerReference.d.ts +3 -2
- package/dist/src/adapters/lib/linkRemotesPlugin.d.ts +2 -1
- package/dist/src/adapters/lib/plugin.d.ts +2 -1
- package/package.json +2 -2
- package/dist/federation-builder.cjs.js +0 -741
- package/dist/federation-builder.esm.js +0 -697
package/README.md
CHANGED
|
@@ -17,45 +17,34 @@ To use the Module Federation plugin with esbuild, add it to your esbuild configu
|
|
|
17
17
|
```js
|
|
18
18
|
const esbuild = require('esbuild');
|
|
19
19
|
const path = require('path');
|
|
20
|
-
const fs = require('fs');
|
|
21
20
|
const { moduleFederationPlugin } = require('@module-federation/esbuild/esbuild-adapter');
|
|
22
|
-
const
|
|
21
|
+
const federationConfig = require('./federation.config.js');
|
|
23
22
|
|
|
24
|
-
async function
|
|
23
|
+
async function buildApp() {
|
|
25
24
|
const tsConfig = 'tsconfig.json';
|
|
26
25
|
const outputPath = path.join('dist', 'host');
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
outputPath,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
mainFields: ['es2020', 'browser', 'module', 'main'],
|
|
47
|
-
conditions: ['es2020', 'es2015', 'module'],
|
|
48
|
-
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
49
|
-
tsconfig: tsConfig,
|
|
50
|
-
splitting: true,
|
|
51
|
-
plugins: [moduleFederationPlugin(federationBuilder)],
|
|
52
|
-
});
|
|
27
|
+
try {
|
|
28
|
+
await esbuild.build({
|
|
29
|
+
entryPoints: [path.join('host', 'main.ts')],
|
|
30
|
+
outdir: outputPath,
|
|
31
|
+
bundle: true,
|
|
32
|
+
platform: 'browser',
|
|
33
|
+
format: 'esm',
|
|
34
|
+
mainFields: ['es2020', 'browser', 'module', 'main'],
|
|
35
|
+
conditions: ['es2020', 'es2015', 'module'],
|
|
36
|
+
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
37
|
+
tsconfig: tsConfig,
|
|
38
|
+
splitting: true,
|
|
39
|
+
plugins: [moduleFederationPlugin(federationConfig)],
|
|
40
|
+
});
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(err);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
|
|
56
|
-
console.error(err);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
47
|
+
buildApp();
|
|
59
48
|
|
|
60
49
|
// Example of federation.config.js
|
|
61
50
|
|
|
@@ -112,3 +101,4 @@ Creates an esbuild plugin for Module Federation.
|
|
|
112
101
|
|
|
113
102
|
Returns an esbuild plugin instance.
|
|
114
103
|
|
|
104
|
+
|