@squide/firefly-webpack-configs 4.2.3 → 5.0.1
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/CHANGELOG.md +31 -19
- package/README.md +2 -2
- package/dist/defineConfig.js +1 -1
- package/dist/defineConfig.js.map +1 -1
- package/package.json +13 -19
- package/src/defineConfig.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,42 +1,54 @@
|
|
|
1
1
|
# @squide/firefly-webpack-configs
|
|
2
2
|
|
|
3
|
+
## 5.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#244](https://github.com/workleap/wl-squide/pull/244) [`5d13eb0`](https://github.com/workleap/wl-squide/commit/5d13eb038a724b499b820d7e1dc864c87954510b) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies.
|
|
8
|
+
|
|
9
|
+
## 5.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#240](https://github.com/workleap/wl-squide/pull/240) [`9a85d23`](https://github.com/workleap/wl-squide/commit/9a85d23b03584e9d98c28d504f5cef3e62b298db) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated dependencies to React Router v7.
|
|
14
|
+
|
|
3
15
|
## 4.2.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
6
18
|
|
|
7
|
-
- [#231](https://github.com/
|
|
19
|
+
- [#231](https://github.com/workleap/wl-squide/pull/231) [`3c6bce0`](https://github.com/workleap/wl-squide/commit/3c6bce0cd559d0b8517d644661b6fb2b818ab2f6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Packages now includes source code and sourcemap.
|
|
8
20
|
|
|
9
21
|
## 4.2.2
|
|
10
22
|
|
|
11
23
|
### Patch Changes
|
|
12
24
|
|
|
13
|
-
- [#225](https://github.com/
|
|
25
|
+
- [#225](https://github.com/workleap/wl-squide/pull/225) [`4eb46d6`](https://github.com/workleap/wl-squide/commit/4eb46d69283804a5809494f7275f9d447022a97d) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added additional shared dependencies for Honeycomb.
|
|
14
26
|
|
|
15
27
|
## 4.2.1
|
|
16
28
|
|
|
17
29
|
### Patch Changes
|
|
18
30
|
|
|
19
|
-
- [#221](https://github.com/
|
|
31
|
+
- [#221](https://github.com/workleap/wl-squide/pull/221) [`8411080`](https://github.com/workleap/wl-squide/commit/8411080dfd0df6d0eafb01888298154fa5e5d925) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fix deferred registrations.
|
|
20
32
|
|
|
21
|
-
- Updated dependencies [[`8411080`](https://github.com/
|
|
33
|
+
- Updated dependencies [[`8411080`](https://github.com/workleap/wl-squide/commit/8411080dfd0df6d0eafb01888298154fa5e5d925)]:
|
|
22
34
|
- @squide/webpack-configs@4.3.1
|
|
23
35
|
|
|
24
36
|
## 4.2.0
|
|
25
37
|
|
|
26
38
|
### Minor Changes
|
|
27
39
|
|
|
28
|
-
- [#219](https://github.com/
|
|
40
|
+
- [#219](https://github.com/workleap/wl-squide/pull/219) [`25cb482`](https://github.com/workleap/wl-squide/commit/25cb482779ee280f3f7109de4607b92dcfeef7f3) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Now dispatching events to enable instrumentation packages for observability platforms.
|
|
29
41
|
|
|
30
42
|
### Patch Changes
|
|
31
43
|
|
|
32
|
-
- Updated dependencies [[`25cb482`](https://github.com/
|
|
44
|
+
- Updated dependencies [[`25cb482`](https://github.com/workleap/wl-squide/commit/25cb482779ee280f3f7109de4607b92dcfeef7f3)]:
|
|
33
45
|
- @squide/webpack-configs@4.3.0
|
|
34
46
|
|
|
35
47
|
## 4.1.0
|
|
36
48
|
|
|
37
49
|
### Minor Changes
|
|
38
50
|
|
|
39
|
-
- [#204](https://github.com/
|
|
51
|
+
- [#204](https://github.com/workleap/wl-squide/pull/204) [`d3f7b9c`](https://github.com/workleap/wl-squide/commit/d3f7b9c6aa80249cd898916f6315ea27c4526812) Thanks [@patricklafrance](https://github.com/patricklafrance)! - The `registerNavigationItem` function now accepts a `sectionId` option to nest the item under a specific navigation section:
|
|
40
52
|
|
|
41
53
|
```ts
|
|
42
54
|
runtime.registerNavigationItem(
|
|
@@ -53,30 +65,30 @@
|
|
|
53
65
|
|
|
54
66
|
### Patch Changes
|
|
55
67
|
|
|
56
|
-
- Updated dependencies [[`d3f7b9c`](https://github.com/
|
|
68
|
+
- Updated dependencies [[`d3f7b9c`](https://github.com/workleap/wl-squide/commit/d3f7b9c6aa80249cd898916f6315ea27c4526812)]:
|
|
57
69
|
- @squide/webpack-configs@4.2.0
|
|
58
70
|
|
|
59
71
|
## 4.0.2
|
|
60
72
|
|
|
61
73
|
### Patch Changes
|
|
62
74
|
|
|
63
|
-
- Updated dependencies [[`52d57fc`](https://github.com/
|
|
75
|
+
- Updated dependencies [[`52d57fc`](https://github.com/workleap/wl-squide/commit/52d57fcc8fcff7b7f6e84d7621724bad8ed9f2a9)]:
|
|
64
76
|
- @squide/webpack-configs@4.1.0
|
|
65
77
|
|
|
66
78
|
## 4.0.1
|
|
67
79
|
|
|
68
80
|
### Patch Changes
|
|
69
81
|
|
|
70
|
-
- [#191](https://github.com/
|
|
82
|
+
- [#191](https://github.com/workleap/wl-squide/pull/191) [`2b62c53`](https://github.com/workleap/wl-squide/commit/2b62c539b0f3123cb47475566181e0b446ea6b40) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated packages description.
|
|
71
83
|
|
|
72
|
-
- Updated dependencies [[`2b62c53`](https://github.com/
|
|
84
|
+
- Updated dependencies [[`2b62c53`](https://github.com/workleap/wl-squide/commit/2b62c539b0f3123cb47475566181e0b446ea6b40)]:
|
|
73
85
|
- @squide/webpack-configs@4.0.1
|
|
74
86
|
|
|
75
87
|
## 4.0.0
|
|
76
88
|
|
|
77
89
|
### Major Changes
|
|
78
90
|
|
|
79
|
-
- [#182](https://github.com/
|
|
91
|
+
- [#182](https://github.com/workleap/wl-squide/pull/182) [`58cf066`](https://github.com/workleap/wl-squide/commit/58cf066e87e23611510c254cca96016bd2bad08a) Thanks [@patricklafrance](https://github.com/patricklafrance)! - ## Firefly v9
|
|
80
92
|
|
|
81
93
|
This major version of @squide/firefly introduces TanStack Query as the official library for fetching the global data of a Squide's application and features a complete rewrite of the AppRouter component, which now uses a state machine to manage the application's bootstrapping flow.
|
|
82
94
|
|
|
@@ -84,7 +96,7 @@
|
|
|
84
96
|
|
|
85
97
|
Finally, with v9, Squide's philosophy has evolved. We used to describe Squide as a shell for federated applications. Now, we refer to Squide as a shell for modular applications. After playing with Squide's local module feature for a while, we discovered that Squide offers significant value even for non-federated applications, which triggered this shift in philosophy.
|
|
86
98
|
|
|
87
|
-
> For a full breakdown of the changres and a migration procedure, read the following [documentation](https://
|
|
99
|
+
> For a full breakdown of the changres and a migration procedure, read the following [documentation](https://workleap.github.io/wl-squide/guides/migrate-to-firefly-v9/).
|
|
88
100
|
|
|
89
101
|
## Breaking changes
|
|
90
102
|
|
|
@@ -126,29 +138,29 @@
|
|
|
126
138
|
- Navigation items now include a `$canRender` option, enabling modules to control whether a navigation item should be rendered.
|
|
127
139
|
- New `$key` option for navigation items.
|
|
128
140
|
|
|
129
|
-
For more details about the changes and a migration procedure, read the following [documentation](https://
|
|
141
|
+
For more details about the changes and a migration procedure, read the following [documentation](https://workleap.github.io/wl-squide/guides/migrate-to-firefly-v9/).
|
|
130
142
|
|
|
131
143
|
### Patch Changes
|
|
132
144
|
|
|
133
|
-
- Updated dependencies [[`58cf066`](https://github.com/
|
|
145
|
+
- Updated dependencies [[`58cf066`](https://github.com/workleap/wl-squide/commit/58cf066e87e23611510c254cca96016bd2bad08a)]:
|
|
134
146
|
- @squide/webpack-configs@4.0.0
|
|
135
147
|
|
|
136
148
|
## 3.0.0
|
|
137
149
|
|
|
138
150
|
### Major Changes
|
|
139
151
|
|
|
140
|
-
- [#170](https://github.com/
|
|
152
|
+
- [#170](https://github.com/workleap/wl-squide/pull/170) [`119570f`](https://github.com/workleap/wl-squide/commit/119570f9c93341285a24e8be879d0a468ee2b5db) Thanks [@patricklafrance](https://github.com/patricklafrance)! - The host define function doesn't accept an "applicationName" anymore as it is now hardcoded to "host".
|
|
141
153
|
|
|
142
154
|
### Patch Changes
|
|
143
155
|
|
|
144
|
-
- Updated dependencies [[`119570f`](https://github.com/
|
|
156
|
+
- Updated dependencies [[`119570f`](https://github.com/workleap/wl-squide/commit/119570f9c93341285a24e8be879d0a468ee2b5db)]:
|
|
145
157
|
- @squide/webpack-configs@3.0.0
|
|
146
158
|
|
|
147
159
|
## 2.0.0
|
|
148
160
|
|
|
149
161
|
### Major Changes
|
|
150
162
|
|
|
151
|
-
- [#168](https://github.com/
|
|
163
|
+
- [#168](https://github.com/workleap/wl-squide/pull/168) [`89ace29`](https://github.com/workleap/wl-squide/commit/89ace29b9aeadbbe83cfa71dd137b9f1a115c283) Thanks [@patricklafrance](https://github.com/patricklafrance)! - This release Migrates Squide from Webpack Module Federation to [Module Federation 2.0](https://module-federation.io/guide/start/quick-start.html).
|
|
152
164
|
|
|
153
165
|
This release deprecates the following packages:
|
|
154
166
|
|
|
@@ -259,5 +271,5 @@
|
|
|
259
271
|
|
|
260
272
|
### Patch Changes
|
|
261
273
|
|
|
262
|
-
- Updated dependencies [[`89ace29`](https://github.com/
|
|
274
|
+
- Updated dependencies [[`89ace29`](https://github.com/workleap/wl-squide/commit/89ace29b9aeadbbe83cfa71dd137b9f1a115c283)]:
|
|
263
275
|
- @squide/webpack-configs@2.0.0
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Usage
|
|
4
4
|
|
|
5
|
-
View the [user's documentation](https://
|
|
5
|
+
View the [user's documentation](https://workleap.github.io/wl-squide/).
|
|
6
6
|
|
|
7
7
|
## 🤝 Contributing
|
|
8
8
|
|
|
@@ -10,4 +10,4 @@ View the [contributor's documentation](../../CONTRIBUTING.md).
|
|
|
10
10
|
|
|
11
11
|
## License
|
|
12
12
|
|
|
13
|
-
Copyright © 2024, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/
|
|
13
|
+
Copyright © 2024, Workleap. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/workleap/workleap-license/blob/master/LICENSE.
|
package/dist/defineConfig.js
CHANGED
|
@@ -64,7 +64,7 @@ function getDefaultSharedDependencies(features, isHost) {
|
|
|
64
64
|
// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning
|
|
65
65
|
function getReactRouterSharedDependencies(isHost) {
|
|
66
66
|
return {
|
|
67
|
-
"react-router
|
|
67
|
+
"react-router": {
|
|
68
68
|
singleton: true,
|
|
69
69
|
eager: isHost ? true : undefined
|
|
70
70
|
},
|
package/dist/defineConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineConfig.js","sources":["webpack://@squide/firefly-webpack-configs/./src/defineConfig.ts"],"sourcesContent":["import { ModuleFederationPlugin } from \"@module-federation/enhanced/webpack\";\nimport type { SwcConfig } from \"@workleap/swc-configs\";\nimport { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineDevConfig, defineDevHtmlWebpackPluginConfig, type DefineBuildConfigOptions, type DefineDevConfigOptions, type WebpackConfig, type WebpackConfigTransformer } from \"@workleap/webpack-configs\";\nimport merge from \"deepmerge\";\nimport type HtmlWebpackPlugin from \"html-webpack-plugin\";\nimport fs from \"node:fs\";\nimport path, { dirname } from \"node:path\";\nimport url, { fileURLToPath } from \"node:url\";\nimport type webpack from \"webpack\";\nimport { HostApplicationName } from \"./shared.ts\";\n\n// Using import.meta.url instead of import.meta.dirname because Jest is throwing the following error:\n// SyntaxError: Cannot use 'import.meta' outside a module\nconst applicationDirectory = dirname(fileURLToPath(import.meta.url));\nconst packageDirectory = url.fileURLToPath(new URL(\".\", import.meta.url));\n\n// Must be similar to the module name defined in @workleap/module-federation.\nconst RemoteRegisterModuleName = \"./register\";\nconst RemoteEntryPoint = \"remoteEntry.js\";\n\n// Webpack doesn't export ModuleFederationPlugin typings.\nexport type ModuleFederationPluginOptions = ConstructorParameters<typeof ModuleFederationPlugin>[0];\nexport type ModuleFederationRemotesOption = ModuleFederationPluginOptions[\"remotes\"];\n\nexport type ModuleFederationRuntimePlugins = NonNullable<ModuleFederationPluginOptions[\"runtimePlugins\"]>;\nexport type ModuleFederationShared = NonNullable<ModuleFederationPluginOptions[\"shared\"]>;\n\n// Generally, only the host application should have eager dependencies.\n// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning\nfunction getDefaultSharedDependencies(features: Features, isHost: boolean): ModuleFederationShared {\n return {\n \"react\": {\n singleton: true,\n eager: isHost ? true : undefined,\n // Fixed the warning when `react-i18next` is imported in any remote modules.\n // For more information, refer to: https://github.com/i18next/react-i18next/issues/1697#issuecomment-1821748226.\n requiredVersion: features.i18next ? false : undefined\n },\n \"react-dom\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/core\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/module-federation\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nexport type Router = \"react-router\";\n\nexport interface Features {\n router?: Router;\n msw?: boolean;\n i18next?: boolean;\n environmentVariables?: boolean;\n honeycomb?: boolean;\n}\n\n// Generally, only the host application should have eager dependencies.\n// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning\nfunction getReactRouterSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"react-router-dom\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/react-router\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getMswSharedDependency(isHost: boolean): ModuleFederationShared {\n return {\n \"@squide/msw\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getI18nextSharedDependency(isHost: boolean): ModuleFederationShared {\n return {\n \"i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n // Not adding as a shared dependency for the moment because it causes the following error:\n // Uncaught (in promise) TypeError: i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_3__ is not a constructor\n // \"i18next-browser-languagedetector\": {\n // singleton: true,\n // eager: isHost ? true : undefined\n // },\n \"react-i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getEnvironmentVariablesSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"@squide/env-vars\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getHoneycombSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"@honeycombio/opentelemetry-web\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@opentelemetry/api\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@opentelemetry/auto-instrumentations-web\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/firefly-honeycomb\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getFeaturesDependencies(features: Features, isHost: boolean) {\n const {\n router = \"react-router\",\n msw = true,\n i18next,\n environmentVariables,\n honeycomb\n } = features;\n\n return {\n ...(router === \"react-router\" ? getReactRouterSharedDependencies(isHost) : {}),\n ...(msw ? getMswSharedDependency(isHost) : {}),\n ...(i18next ? getI18nextSharedDependency(isHost) : {}),\n ...(environmentVariables ? getEnvironmentVariablesSharedDependencies(isHost) : {}),\n ...(honeycomb ? getHoneycombSharedDependencies(isHost) : {})\n };\n}\n\nfunction resolveDefaultSharedDependencies(features: Features, isHost: boolean) {\n return {\n ...getDefaultSharedDependencies(features, isHost),\n ...getFeaturesDependencies(features, isHost)\n };\n}\n\nconst forceNamedChunkIdsTransformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n config.optimization = {\n ...(config.optimization ?? {}),\n // Without named chunk ids, there are some Webpack features that do not work\n // when used with Module Federation. One of these feature is using a dynamic import in\n // a remote module.\n chunkIds: \"named\"\n };\n\n return config;\n};\n\nfunction createSetUniqueNameTransformer(uniqueName: string) {\n const transformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n config.output = {\n ...(config.output ?? {}),\n // Every host and remotes must have a \"uniqueName\" for React Refresh to work\n // with Module Federation.\n uniqueName\n };\n\n return config;\n };\n\n return transformer;\n}\n\nfunction resolveEntryFilePath(entryPaths: string[]) {\n for (const entryPath in entryPaths) {\n if (fs.existsSync(path.resolve(applicationDirectory, entryPath))) {\n return entryPath;\n }\n }\n\n return entryPaths[0];\n}\n\n//////////////////////////// Host /////////////////////////////\n\nexport interface RemoteDefinition {\n // The name of the remote module.\n name: string;\n // The URL of the remote, ex: http://localhost:8081.\n url: string;\n}\n\nconst HostEntryFilePaths = [\n \"./src/index.ts\",\n \"./src/index.tsx\"\n];\n\nexport interface DefineHostModuleFederationPluginOptions extends ModuleFederationPluginOptions {\n features?: Features;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineHostModuleFederationPluginOptions(remotes: RemoteDefinition[], options: DefineHostModuleFederationPluginOptions): ModuleFederationPluginOptions {\n const {\n features = {},\n shared = {},\n runtimePlugins = [],\n ...rest\n } = options;\n\n const defaultSharedDependencies = resolveDefaultSharedDependencies(features, true);\n\n return {\n name: HostApplicationName,\n // Since Squide modules are only exporting a register function with a standardized API\n // it doesn't requires any typing.\n dts: false,\n // Currently only supporting .js remotes.\n manifest: false,\n remotes: remotes.reduce((acc, x) => {\n // Object reduce are always a mess for typings.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n acc[x.name] = `${x.name}@${x.url}/${RemoteEntryPoint}`;\n\n return acc;\n }, {}) as ModuleFederationRemotesOption,\n // Deep merging the default shared dependencies with the provided shared dependencies\n // to allow the consumer to easily override a default option of a shared dependency\n // without extending the whole default shared dependencies object.\n shared: merge.all([\n defaultSharedDependencies,\n shared\n ]) as ModuleFederationShared,\n runtimePlugins: [\n path.resolve(packageDirectory, \"./sharedDependenciesResolutionPlugin.js\"),\n path.resolve(packageDirectory, \"./nonCacheableRemoteEntryPlugin.js\"),\n ...runtimePlugins\n ],\n // Commented because it doesn't seems to work, the runtime is still embedded into remotes.\n // experiments: {\n // // The runtime is 100kb minified.\n // federationRuntime: \"hoisted\"\n // },\n ...rest\n };\n}\n\n// Fixing HMR and page reloads when using `publicPath: auto` either in the host or remotes webpack configuration.\n// Otherwise, when a nested page that belongs to a remote module is reloaded, an \"Unexpected token\" error will be thrown.\nfunction trySetHtmlWebpackPluginPublicPath(options: HtmlWebpackPlugin.Options) {\n if (!options.publicPath) {\n options.publicPath = \"/\";\n }\n\n return options;\n}\n\nexport interface DefineDevHostConfigOptions extends Omit<DefineDevConfigOptions, \"htmlWebpackPlugin\" | \"port\"> {\n htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineDevHostConfig(swcConfig: SwcConfig, port: number, remotes: RemoteDefinition[], options: DefineDevHostConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(HostEntryFilePaths),\n publicPath = \"auto\",\n cache,\n plugins = [],\n htmlWebpackPluginOptions,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineDevConfig(swcConfig, {\n entry,\n port,\n publicPath,\n cache,\n htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? defineBuildHtmlWebpackPluginConfig()),\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n ...webpackOptions,\n transformers: [\n createSetUniqueNameTransformer(HostApplicationName),\n ...transformers\n ]\n });\n}\n\nexport interface DefineBuildHostConfigOptions extends Omit<DefineBuildConfigOptions, \"htmlWebpackPlugin\"> {\n htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineBuildHostConfig(swcConfig: SwcConfig, remotes: RemoteDefinition[], options: DefineBuildHostConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(HostEntryFilePaths),\n publicPath = \"auto\",\n plugins = [],\n htmlWebpackPluginOptions,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineBuildConfig(swcConfig, {\n entry,\n publicPath,\n htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? defineDevHtmlWebpackPluginConfig()),\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n forceNamedChunkIdsTransformer,\n createSetUniqueNameTransformer(HostApplicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n\n//////////////////////////// Remote /////////////////////////////\n\nconst RemoteEntryFilePaths = [\n \"./src/register.tsx\",\n \"./src/register.ts\"\n];\n\nexport interface DefineRemoteModuleFederationPluginOptions extends ModuleFederationPluginOptions {\n features?: Features;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineRemoteModuleFederationPluginOptions(applicationName: string, options: DefineRemoteModuleFederationPluginOptions): ModuleFederationPluginOptions {\n const {\n features = {},\n exposes = {},\n shared = {},\n runtimePlugins = [],\n ...rest\n } = options;\n\n const defaultSharedDependencies = resolveDefaultSharedDependencies(features, false);\n\n return {\n name: applicationName,\n // Since Squide modules are only exporting a register function with a standardized API\n // it doesn't requires any typing.\n dts: false,\n // Currently only supporting .js remotes.\n manifest: false,\n filename: RemoteEntryPoint,\n exposes: {\n [RemoteRegisterModuleName]: \"./src/register\",\n ...exposes\n },\n // Deep merging the default shared dependencies with the provided shared dependencies\n // to allow the consumer to easily override a default option of a shared dependency\n // without extending the whole default shared dependencies object.\n shared: merge.all([\n defaultSharedDependencies,\n shared\n ]) as ModuleFederationShared,\n runtimePlugins: [\n path.resolve(packageDirectory, \"./sharedDependenciesResolutionPlugin.js\"),\n path.resolve(packageDirectory, \"./nonCacheableRemoteEntryPlugin.js\"),\n ...runtimePlugins\n ],\n // Commented because it doesn't seems to work, the runtime is still embedded into remotes.\n // experiments: {\n // // The runtime is 100kb minified.\n // federationRuntime: \"hoisted\"\n // },\n ...rest\n };\n}\n\nconst devRemoteModuleTransformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n // \"config.devServer\" does exist but webpack types are a messed. It could probably be solved by importing \"webpack-dev-server\"\n // but I would prefer not adding it as a project dependency.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config.devServer.headers = {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n ...(config.devServer.headers ?? {}),\n // Otherwise hot reload in the host failed with a CORS error.\n \"Access-Control-Allow-Origin\": \"*\"\n };\n\n return config;\n};\n\nexport interface DefineDevRemoteModuleConfigOptions extends Omit<DefineDevConfigOptions, \"port\" | \"overlay\"> {\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineDevRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, port: number, options: DefineDevRemoteModuleConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(RemoteEntryFilePaths),\n publicPath = \"auto\",\n cache,\n plugins = [],\n htmlWebpackPlugin = false,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineDevConfig(swcConfig, {\n entry,\n port,\n publicPath,\n cache,\n htmlWebpackPlugin,\n // Disable the error overlay by default for remotes as otherwise every remote module's error overlay will be\n // stack on top of the host application's error overlay.\n overlay: false,\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n devRemoteModuleTransformer,\n createSetUniqueNameTransformer(applicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n\nexport interface DefineBuildRemoteModuleConfigOptions extends DefineBuildConfigOptions {\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineBuildRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, options: DefineBuildRemoteModuleConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(RemoteEntryFilePaths),\n publicPath = \"auto\",\n plugins = [],\n htmlWebpackPlugin = false,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineBuildConfig(swcConfig, {\n entry,\n publicPath,\n htmlWebpackPlugin,\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n forceNamedChunkIdsTransformer,\n createSetUniqueNameTransformer(applicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n"],"names":["ModuleFederationPlugin","defineBuildConfig","defineBuildHtmlWebpackPluginConfig","defineDevConfig","defineDevHtmlWebpackPluginConfig","merge","fs","path","dirname","url","fileURLToPath","HostApplicationName","applicationDirectory","packageDirectory","URL","RemoteRegisterModuleName","RemoteEntryPoint","getDefaultSharedDependencies","features","isHost","undefined","getReactRouterSharedDependencies","getMswSharedDependency","getI18nextSharedDependency","getEnvironmentVariablesSharedDependencies","getHoneycombSharedDependencies","getFeaturesDependencies","router","msw","i18next","environmentVariables","honeycomb","resolveDefaultSharedDependencies","forceNamedChunkIdsTransformer","config","createSetUniqueNameTransformer","uniqueName","transformer","resolveEntryFilePath","entryPaths","entryPath","HostEntryFilePaths","defineHostModuleFederationPluginOptions","remotes","options","shared","runtimePlugins","rest","defaultSharedDependencies","acc","x","trySetHtmlWebpackPluginPublicPath","defineDevHostConfig","swcConfig","port","entry","publicPath","cache","plugins","htmlWebpackPluginOptions","transformers","sharedDependencies","moduleFederationPluginOptions","webpackOptions","defineBuildHostConfig","RemoteEntryFilePaths","defineRemoteModuleFederationPluginOptions","applicationName","exposes","devRemoteModuleTransformer","defineDevRemoteModuleConfig","htmlWebpackPlugin","defineBuildRemoteModuleConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA6E;AAEuL;AACtO;AAEL;AACiB;AACI;AAEI;AAElD,qGAAqG;AACrG,yDAAyD;AACzD,MAAMY,uBAAuBJ,0DAAOA,CAACE,+DAAaA,CAAC,YAAY,GAAG;AAClE,MAAMG,mBAAmBJ,sEAAiB,CAAC,IAAIK,IAAI,KAAK,YAAY,GAAG;AAEvE,6EAA6E;AAC7E,MAAMC,2BAA2B;AACjC,MAAMC,mBAAmB;AASzB,uEAAuE;AACvE,8GAA8G;AAC9G,SAASC,6BAA6BC,QAAkB,EAAEC,MAAe;IACrE,OAAO;QACH,SAAS;YACL,WAAW;YACX,OAAOA,SAAS,OAAOC;YACvB,4EAA4E;YAC5E,gHAAgH;YAChH,iBAAiBF,SAAS,OAAO,GAAG,QAAQE;QAChD;QACA,aAAa;YACT,WAAW;YACX,OAAOD,SAAS,OAAOC;QAC3B;QACA,gBAAgB;YACZ,WAAW;YACX,OAAOD,SAAS,OA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;IAC3I,MAAM,EACFW,QAAQjB,qBAAqB2B,qBAAqB,EAClDT,aAAa,MAAM,EACnBE,UAAU,EAAE,EACZa,oBAAoB,KAAK,EACzBX,eAAe,EAAE,EACjB1C,QAAQ,EACR2C,kBAAkB,EAClBf,cAAc,EACdgB,gCAAgCI,0CAA0CC,iBAAiB;QAAEjD;QAAU,QAAQ2C;QAAoBf;IAAe,EAAE,EACpJ,GAAGiB,gBACN,GAAGnB;IAEJ,OAAO3C,oFAAiBA,CAACoD,WAAW;QAChCE;QACAC;QACAe;QACA,SAAS;eACFb;YACH,IAAI1D,+FAAsBA,CAAC8D;SAC9B;QACD,cAAc;YACV7B;YACAE,+BAA+BgC;eAC5BP;SACN;QACD,GAAGG,cAAc;IACrB;AACJ"}
|
|
1
|
+
{"version":3,"file":"defineConfig.js","sources":["webpack://@squide/firefly-webpack-configs/./src/defineConfig.ts"],"sourcesContent":["import { ModuleFederationPlugin } from \"@module-federation/enhanced/webpack\";\nimport type { SwcConfig } from \"@workleap/swc-configs\";\nimport { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineDevConfig, defineDevHtmlWebpackPluginConfig, type DefineBuildConfigOptions, type DefineDevConfigOptions, type WebpackConfig, type WebpackConfigTransformer } from \"@workleap/webpack-configs\";\nimport merge from \"deepmerge\";\nimport type HtmlWebpackPlugin from \"html-webpack-plugin\";\nimport fs from \"node:fs\";\nimport path, { dirname } from \"node:path\";\nimport url, { fileURLToPath } from \"node:url\";\nimport type webpack from \"webpack\";\nimport { HostApplicationName } from \"./shared.ts\";\n\n// Using import.meta.url instead of import.meta.dirname because Jest is throwing the following error:\n// SyntaxError: Cannot use 'import.meta' outside a module\nconst applicationDirectory = dirname(fileURLToPath(import.meta.url));\nconst packageDirectory = url.fileURLToPath(new URL(\".\", import.meta.url));\n\n// Must be similar to the module name defined in @workleap/module-federation.\nconst RemoteRegisterModuleName = \"./register\";\nconst RemoteEntryPoint = \"remoteEntry.js\";\n\n// Webpack doesn't export ModuleFederationPlugin typings.\nexport type ModuleFederationPluginOptions = ConstructorParameters<typeof ModuleFederationPlugin>[0];\nexport type ModuleFederationRemotesOption = ModuleFederationPluginOptions[\"remotes\"];\n\nexport type ModuleFederationRuntimePlugins = NonNullable<ModuleFederationPluginOptions[\"runtimePlugins\"]>;\nexport type ModuleFederationShared = NonNullable<ModuleFederationPluginOptions[\"shared\"]>;\n\n// Generally, only the host application should have eager dependencies.\n// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning\nfunction getDefaultSharedDependencies(features: Features, isHost: boolean): ModuleFederationShared {\n return {\n \"react\": {\n singleton: true,\n eager: isHost ? true : undefined,\n // Fixed the warning when `react-i18next` is imported in any remote modules.\n // For more information, refer to: https://github.com/i18next/react-i18next/issues/1697#issuecomment-1821748226.\n requiredVersion: features.i18next ? false : undefined\n },\n \"react-dom\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/core\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/module-federation\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nexport type Router = \"react-router\";\n\nexport interface Features {\n router?: Router;\n msw?: boolean;\n i18next?: boolean;\n environmentVariables?: boolean;\n honeycomb?: boolean;\n}\n\n// Generally, only the host application should have eager dependencies.\n// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning\nfunction getReactRouterSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"react-router\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/react-router\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getMswSharedDependency(isHost: boolean): ModuleFederationShared {\n return {\n \"@squide/msw\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getI18nextSharedDependency(isHost: boolean): ModuleFederationShared {\n return {\n \"i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n // Not adding as a shared dependency for the moment because it causes the following error:\n // Uncaught (in promise) TypeError: i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_3__ is not a constructor\n // \"i18next-browser-languagedetector\": {\n // singleton: true,\n // eager: isHost ? true : undefined\n // },\n \"react-i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/i18next\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getEnvironmentVariablesSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"@squide/env-vars\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getHoneycombSharedDependencies(isHost: boolean): ModuleFederationShared {\n return {\n \"@honeycombio/opentelemetry-web\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@opentelemetry/api\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@opentelemetry/auto-instrumentations-web\": {\n singleton: true,\n eager: isHost ? true : undefined\n },\n \"@squide/firefly-honeycomb\": {\n singleton: true,\n eager: isHost ? true : undefined\n }\n };\n}\n\nfunction getFeaturesDependencies(features: Features, isHost: boolean) {\n const {\n router = \"react-router\",\n msw = true,\n i18next,\n environmentVariables,\n honeycomb\n } = features;\n\n return {\n ...(router === \"react-router\" ? getReactRouterSharedDependencies(isHost) : {}),\n ...(msw ? getMswSharedDependency(isHost) : {}),\n ...(i18next ? getI18nextSharedDependency(isHost) : {}),\n ...(environmentVariables ? getEnvironmentVariablesSharedDependencies(isHost) : {}),\n ...(honeycomb ? getHoneycombSharedDependencies(isHost) : {})\n };\n}\n\nfunction resolveDefaultSharedDependencies(features: Features, isHost: boolean) {\n return {\n ...getDefaultSharedDependencies(features, isHost),\n ...getFeaturesDependencies(features, isHost)\n };\n}\n\nconst forceNamedChunkIdsTransformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n config.optimization = {\n ...(config.optimization ?? {}),\n // Without named chunk ids, there are some Webpack features that do not work\n // when used with Module Federation. One of these feature is using a dynamic import in\n // a remote module.\n chunkIds: \"named\"\n };\n\n return config;\n};\n\nfunction createSetUniqueNameTransformer(uniqueName: string) {\n const transformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n config.output = {\n ...(config.output ?? {}),\n // Every host and remotes must have a \"uniqueName\" for React Refresh to work\n // with Module Federation.\n uniqueName\n };\n\n return config;\n };\n\n return transformer;\n}\n\nfunction resolveEntryFilePath(entryPaths: string[]) {\n for (const entryPath in entryPaths) {\n if (fs.existsSync(path.resolve(applicationDirectory, entryPath))) {\n return entryPath;\n }\n }\n\n return entryPaths[0];\n}\n\n//////////////////////////// Host /////////////////////////////\n\nexport interface RemoteDefinition {\n // The name of the remote module.\n name: string;\n // The URL of the remote, ex: http://localhost:8081.\n url: string;\n}\n\nconst HostEntryFilePaths = [\n \"./src/index.ts\",\n \"./src/index.tsx\"\n];\n\nexport interface DefineHostModuleFederationPluginOptions extends ModuleFederationPluginOptions {\n features?: Features;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineHostModuleFederationPluginOptions(remotes: RemoteDefinition[], options: DefineHostModuleFederationPluginOptions): ModuleFederationPluginOptions {\n const {\n features = {},\n shared = {},\n runtimePlugins = [],\n ...rest\n } = options;\n\n const defaultSharedDependencies = resolveDefaultSharedDependencies(features, true);\n\n return {\n name: HostApplicationName,\n // Since Squide modules are only exporting a register function with a standardized API\n // it doesn't requires any typing.\n dts: false,\n // Currently only supporting .js remotes.\n manifest: false,\n remotes: remotes.reduce((acc, x) => {\n // Object reduce are always a mess for typings.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n acc[x.name] = `${x.name}@${x.url}/${RemoteEntryPoint}`;\n\n return acc;\n }, {}) as ModuleFederationRemotesOption,\n // Deep merging the default shared dependencies with the provided shared dependencies\n // to allow the consumer to easily override a default option of a shared dependency\n // without extending the whole default shared dependencies object.\n shared: merge.all([\n defaultSharedDependencies,\n shared\n ]) as ModuleFederationShared,\n runtimePlugins: [\n path.resolve(packageDirectory, \"./sharedDependenciesResolutionPlugin.js\"),\n path.resolve(packageDirectory, \"./nonCacheableRemoteEntryPlugin.js\"),\n ...runtimePlugins\n ],\n // Commented because it doesn't seems to work, the runtime is still embedded into remotes.\n // experiments: {\n // // The runtime is 100kb minified.\n // federationRuntime: \"hoisted\"\n // },\n ...rest\n };\n}\n\n// Fixing HMR and page reloads when using `publicPath: auto` either in the host or remotes webpack configuration.\n// Otherwise, when a nested page that belongs to a remote module is reloaded, an \"Unexpected token\" error will be thrown.\nfunction trySetHtmlWebpackPluginPublicPath(options: HtmlWebpackPlugin.Options) {\n if (!options.publicPath) {\n options.publicPath = \"/\";\n }\n\n return options;\n}\n\nexport interface DefineDevHostConfigOptions extends Omit<DefineDevConfigOptions, \"htmlWebpackPlugin\" | \"port\"> {\n htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineDevHostConfig(swcConfig: SwcConfig, port: number, remotes: RemoteDefinition[], options: DefineDevHostConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(HostEntryFilePaths),\n publicPath = \"auto\",\n cache,\n plugins = [],\n htmlWebpackPluginOptions,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineDevConfig(swcConfig, {\n entry,\n port,\n publicPath,\n cache,\n htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? defineBuildHtmlWebpackPluginConfig()),\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n ...webpackOptions,\n transformers: [\n createSetUniqueNameTransformer(HostApplicationName),\n ...transformers\n ]\n });\n}\n\nexport interface DefineBuildHostConfigOptions extends Omit<DefineBuildConfigOptions, \"htmlWebpackPlugin\"> {\n htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineBuildHostConfig(swcConfig: SwcConfig, remotes: RemoteDefinition[], options: DefineBuildHostConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(HostEntryFilePaths),\n publicPath = \"auto\",\n plugins = [],\n htmlWebpackPluginOptions,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineBuildConfig(swcConfig, {\n entry,\n publicPath,\n htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? defineDevHtmlWebpackPluginConfig()),\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n forceNamedChunkIdsTransformer,\n createSetUniqueNameTransformer(HostApplicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n\n//////////////////////////// Remote /////////////////////////////\n\nconst RemoteEntryFilePaths = [\n \"./src/register.tsx\",\n \"./src/register.ts\"\n];\n\nexport interface DefineRemoteModuleFederationPluginOptions extends ModuleFederationPluginOptions {\n features?: Features;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineRemoteModuleFederationPluginOptions(applicationName: string, options: DefineRemoteModuleFederationPluginOptions): ModuleFederationPluginOptions {\n const {\n features = {},\n exposes = {},\n shared = {},\n runtimePlugins = [],\n ...rest\n } = options;\n\n const defaultSharedDependencies = resolveDefaultSharedDependencies(features, false);\n\n return {\n name: applicationName,\n // Since Squide modules are only exporting a register function with a standardized API\n // it doesn't requires any typing.\n dts: false,\n // Currently only supporting .js remotes.\n manifest: false,\n filename: RemoteEntryPoint,\n exposes: {\n [RemoteRegisterModuleName]: \"./src/register\",\n ...exposes\n },\n // Deep merging the default shared dependencies with the provided shared dependencies\n // to allow the consumer to easily override a default option of a shared dependency\n // without extending the whole default shared dependencies object.\n shared: merge.all([\n defaultSharedDependencies,\n shared\n ]) as ModuleFederationShared,\n runtimePlugins: [\n path.resolve(packageDirectory, \"./sharedDependenciesResolutionPlugin.js\"),\n path.resolve(packageDirectory, \"./nonCacheableRemoteEntryPlugin.js\"),\n ...runtimePlugins\n ],\n // Commented because it doesn't seems to work, the runtime is still embedded into remotes.\n // experiments: {\n // // The runtime is 100kb minified.\n // federationRuntime: \"hoisted\"\n // },\n ...rest\n };\n}\n\nconst devRemoteModuleTransformer: WebpackConfigTransformer = (config: WebpackConfig) => {\n // \"config.devServer\" does exist but webpack types are a messed. It could probably be solved by importing \"webpack-dev-server\"\n // but I would prefer not adding it as a project dependency.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config.devServer.headers = {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n ...(config.devServer.headers ?? {}),\n // Otherwise hot reload in the host failed with a CORS error.\n \"Access-Control-Allow-Origin\": \"*\"\n };\n\n return config;\n};\n\nexport interface DefineDevRemoteModuleConfigOptions extends Omit<DefineDevConfigOptions, \"port\" | \"overlay\"> {\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineDevRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, port: number, options: DefineDevRemoteModuleConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(RemoteEntryFilePaths),\n publicPath = \"auto\",\n cache,\n plugins = [],\n htmlWebpackPlugin = false,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineDevConfig(swcConfig, {\n entry,\n port,\n publicPath,\n cache,\n htmlWebpackPlugin,\n // Disable the error overlay by default for remotes as otherwise every remote module's error overlay will be\n // stack on top of the host application's error overlay.\n overlay: false,\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n devRemoteModuleTransformer,\n createSetUniqueNameTransformer(applicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n\nexport interface DefineBuildRemoteModuleConfigOptions extends DefineBuildConfigOptions {\n features?: Features;\n sharedDependencies?: ModuleFederationShared;\n runtimePlugins?: ModuleFederationRuntimePlugins;\n moduleFederationPluginOptions?: ModuleFederationPluginOptions;\n}\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function defineBuildRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, options: DefineBuildRemoteModuleConfigOptions = {}): webpack.Configuration {\n const {\n entry = resolveEntryFilePath(RemoteEntryFilePaths),\n publicPath = \"auto\",\n plugins = [],\n htmlWebpackPlugin = false,\n transformers = [],\n features,\n sharedDependencies,\n runtimePlugins,\n moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, { features, shared: sharedDependencies, runtimePlugins }),\n ...webpackOptions\n } = options;\n\n return defineBuildConfig(swcConfig, {\n entry,\n publicPath,\n htmlWebpackPlugin,\n plugins: [\n ...plugins,\n new ModuleFederationPlugin(moduleFederationPluginOptions)\n ],\n transformers: [\n forceNamedChunkIdsTransformer,\n createSetUniqueNameTransformer(applicationName),\n ...transformers\n ],\n ...webpackOptions\n });\n}\n"],"names":["ModuleFederationPlugin","defineBuildConfig","defineBuildHtmlWebpackPluginConfig","defineDevConfig","defineDevHtmlWebpackPluginConfig","merge","fs","path","dirname","url","fileURLToPath","HostApplicationName","applicationDirectory","packageDirectory","URL","RemoteRegisterModuleName","RemoteEntryPoint","getDefaultSharedDependencies","features","isHost","undefined","getReactRouterSharedDependencies","getMswSharedDependency","getI18nextSharedDependency","getEnvironmentVariablesSharedDependencies","getHoneycombSharedDependencies","getFeaturesDependencies","router","msw","i18next","environmentVariables","honeycomb","resolveDefaultSharedDependencies","forceNamedChunkIdsTransformer","config","createSetUniqueNameTransformer","uniqueName","transformer","resolveEntryFilePath","entryPaths","entryPath","HostEntryFilePaths","defineHostModuleFederationPluginOptions","remotes","options","shared","runtimePlugins","rest","defaultSharedDependencies","acc","x","trySetHtmlWebpackPluginPublicPath","defineDevHostConfig","swcConfig","port","entry","publicPath","cache","plugins","htmlWebpackPluginOptions","transformers","sharedDependencies","moduleFederationPluginOptions","webpackOptions","defineBuildHostConfig","RemoteEntryFilePaths","defineRemoteModuleFederationPluginOptions","applicationName","exposes","devRemoteModuleTransformer","defineDevRemoteModuleConfig","htmlWebpackPlugin","defineBuildRemoteModuleConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA6E;AAEuL;AACtO;AAEL;AACiB;AACI;AAEI;AAElD,qGAAqG;AACrG,yDAAyD;AACzD,MAAMY,uBAAuBJ,0DAAOA,CAACE,+DAAaA,CAAC,YAAY,GAAG;AAClE,MAAMG,mBAAmBJ,sEAAiB,CAAC,IAAIK,IAAI,KAAK,YAAY,GAAG;AAEvE,6EAA6E;AAC7E,MAAMC,2BAA2B;AACjC,MAAMC,mBAAmB;AASzB,uEAAuE;AACvE,8GAA8G;AAC9G,SAASC,6BAA6BC,QAAkB,EAAEC,MAAe;IACrE,OAAO;QACH,SAAS;YACL,WAAW;YACX,OAAOA,SAAS,OAAOC;YACvB,4EAA4E;YAC5E,gHAAgH;YAChH,iBAAiBF,SAAS,OAAO,GAAG,QAAQE;QAChD;QACA,aAAa;YACT,WAAW;YACX,OAAOD,SAAS,OAAOC;QAC3B;QACA,gBAAgB;YACZ,WAAW;YACX,OAAOD,SAAS,OAAOC;QAC3B;QACA,6BAA6B;YACzB,WAAW;YACX,O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AqB,EAClDT,aAAa,MAAM,EACnBE,UAAU,EAAE,EACZa,oBAAoB,KAAK,EACzBX,eAAe,EAAE,EACjB1C,QAAQ,EACR2C,kBAAkB,EAClBf,cAAc,EACdgB,gCAAgCI,0CAA0CC,iBAAiB;QAAEjD;QAAU,QAAQ2C;QAAoBf;IAAe,EAAE,EACpJ,GAAGiB,gBACN,GAAGnB;IAEJ,OAAO3C,oFAAiBA,CAACoD,WAAW;QAChCE;QACAC;QACAe;QACA,SAAS;eACFb;YACH,IAAI1D,+FAAsBA,CAAC8D;SAC9B;QACD,cAAc;YACV7B;YACAE,+BAA+BgC;eAC5BP;SACN;QACD,GAAGG,cAAc;IACrB;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly-webpack-configs",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.1",
|
|
5
5
|
"description": "Webpack configuration helpers for the Squide firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/workleap/wl-squide.git",
|
|
10
10
|
"directory": "packages/firefly-webpack-configs"
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
@@ -37,31 +37,25 @@
|
|
|
37
37
|
"webpack-dev-server": ">=5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@module-federation/enhanced": "^0.
|
|
41
|
-
"@types/node": "^22.10
|
|
40
|
+
"@module-federation/enhanced": "^0.10.0",
|
|
41
|
+
"@types/node": "^22.13.10",
|
|
42
42
|
"@types/semver": "^7.5.8",
|
|
43
43
|
"@workleap/webpack-configs": "^1.5.3",
|
|
44
44
|
"deepmerge": "^4.3.1",
|
|
45
45
|
"html-webpack-plugin": "^5.6.3",
|
|
46
|
-
"semver": "^7.
|
|
46
|
+
"semver": "^7.7.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@rsbuild/core": "1.
|
|
50
|
-
"@rslib/core": "0.
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@types/jest": "29.5.14",
|
|
54
|
-
"@typescript-eslint/parser": "8.20.0",
|
|
55
|
-
"@workleap/eslint-plugin": "3.2.6",
|
|
49
|
+
"@rsbuild/core": "1.2.19",
|
|
50
|
+
"@rslib/core": "0.5.4",
|
|
51
|
+
"@typescript-eslint/parser": "8.26.1",
|
|
52
|
+
"@workleap/eslint-plugin": "3.3.0",
|
|
56
53
|
"@workleap/rslib-configs": "1.0.2",
|
|
57
|
-
"@workleap/swc-configs": "2.2.4",
|
|
58
54
|
"@workleap/typescript-configs": "3.0.2",
|
|
59
55
|
"eslint": "8.57.0",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"typescript": "5.5.4",
|
|
64
|
-
"webpack": "5.97.1",
|
|
56
|
+
"typescript": "5.8.2",
|
|
57
|
+
"vitest": "3.0.8",
|
|
58
|
+
"webpack": "5.98.0",
|
|
65
59
|
"webpack-dev-server": "5.2.0"
|
|
66
60
|
},
|
|
67
61
|
"engines": {
|
|
@@ -72,6 +66,6 @@
|
|
|
72
66
|
"build": "rslib build --config ./rslib.build.ts",
|
|
73
67
|
"eslint": "eslint . --max-warnings=-0 --cache --cache-location node_modules/.cache/eslint",
|
|
74
68
|
"typecheck": "tsc",
|
|
75
|
-
"test": "
|
|
69
|
+
"test": "vitest --config vitest.config.ts --no-watch"
|
|
76
70
|
}
|
|
77
71
|
}
|
package/src/defineConfig.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface Features {
|
|
|
65
65
|
// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning
|
|
66
66
|
function getReactRouterSharedDependencies(isHost: boolean): ModuleFederationShared {
|
|
67
67
|
return {
|
|
68
|
-
"react-router
|
|
68
|
+
"react-router": {
|
|
69
69
|
singleton: true,
|
|
70
70
|
eager: isHost ? true : undefined
|
|
71
71
|
},
|