@module-federation/esbuild 0.0.0-next-20240524225331 → 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 -35
- 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
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
Here's an updated README.md that incorporates the plugin options and ensures they are met:
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
# @module-federation/esbuild
|
|
5
2
|
|
|
6
3
|
This package provides an esbuild plugin for Module Federation, enabling you to easily share code between independently built and deployed applications.
|
|
@@ -20,45 +17,34 @@ To use the Module Federation plugin with esbuild, add it to your esbuild configu
|
|
|
20
17
|
```js
|
|
21
18
|
const esbuild = require('esbuild');
|
|
22
19
|
const path = require('path');
|
|
23
|
-
const fs = require('fs');
|
|
24
20
|
const { moduleFederationPlugin } = require('@module-federation/esbuild/esbuild-adapter');
|
|
25
|
-
const
|
|
21
|
+
const federationConfig = require('./federation.config.js');
|
|
26
22
|
|
|
27
|
-
async function
|
|
23
|
+
async function buildApp() {
|
|
28
24
|
const tsConfig = 'tsconfig.json';
|
|
29
25
|
const outputPath = path.join('dist', 'host');
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
outputPath,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
mainFields: ['es2020', 'browser', 'module', 'main'],
|
|
50
|
-
conditions: ['es2020', 'es2015', 'module'],
|
|
51
|
-
resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
52
|
-
tsconfig: tsConfig,
|
|
53
|
-
splitting: true,
|
|
54
|
-
plugins: [moduleFederationPlugin(federationBuilder)],
|
|
55
|
-
});
|
|
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
|
+
}
|
|
56
45
|
}
|
|
57
46
|
|
|
58
|
-
|
|
59
|
-
console.error(err);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
47
|
+
buildApp();
|
|
62
48
|
|
|
63
49
|
// Example of federation.config.js
|
|
64
50
|
|
|
@@ -115,3 +101,4 @@ Creates an esbuild plugin for Module Federation.
|
|
|
115
101
|
|
|
116
102
|
Returns an esbuild plugin instance.
|
|
117
103
|
|
|
104
|
+
|