56 Commits

Author SHA1 Message Date
Colum Ferry
d72a1d4e6e
fix(react): ensure interop between webpack and rspack module federation (#27824)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When we had initially designed our Module Federation support for React,
we had to get some changes put in place in webpack itself directly to
allow for ESM.

However, the best support for Module Federation for both Rspack and
Webpack comes from CJS.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Ensure CJS is used to ensure interopability between webpack and rspack
module federation applications

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-09-09 15:52:16 +01:00
Colum Ferry
f17e5efc08
fix(module-federation): ssr uses async-node with runtime plugin (#27492)
- fix(module-federation): SSR should work correctly
- fix(module-federation): ssr-dev-servers should wait for remotes before
starting final executor

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-09-04 11:33:24 -04:00
Colum Ferry
f208acde54
fix(module-federation): optimization should not be overwritten #27201 (#27376)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
`withModuleFederation` is overwriting `config.optimization` rather than
merging it.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`config.optimization` should be merged

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27201
2024-08-12 15:29:55 +01:00
Colum Ferry
483bcf3465
feat(module-federation): add nx-runtime-library-control-plugin (#26816)
- feat(module-federation): use @module-federation/enhanced for
withModuleFederation
- feat(module-federation): expose API for users to override module
federation plugin options
- fix(module-federation): angular mf ssr projects should not create
vendor chunks
- feat(module-federation): add nx-runtime-library-control-plugin

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
A common occurrence when working with NX Module Federation is that a
shared library may get resolved from a static remote.
Any changes to the shared lib are therefore not reflected in the dev
server.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Add the `nx-runtime-library-control-plugin` to ensure that shared
libraries are shared from a remote that is served via
webpack-dev-server.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #11615
2024-07-17 22:46:14 -04:00
Colum Ferry
a6522f71a1
feat(module-federation): use @module-federation/enhanced for withModuleFederation (#26777)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
We currently use the `ModuleFederationPlugin` from `webpack` itself. 
This doesn't receive the same attention as the new
`@module-federation/enhanced` package, which is where all new work by
Zack Jackson and Bytedance is being conducted.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Our `withModuleFederation` utils should use the
`@module-federation/enhanced` package.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
#26322 
Fixes #
2024-07-05 09:48:17 -04:00
Colum Ferry
61839443ca
fix(react): HMR for withModuleFederation #22300 (#22562) 2024-03-28 16:57:25 +00:00
Jason Jean
396ffc4636
feat(core): enable project crystal by default (#21403)
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
Co-authored-by: Emily Xiong <xiongemi@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
2024-02-02 03:40:59 -05:00
Ashwin Gokhale
d9540ef7cd
feat(react): Treat window and var library types the same (#20597) 2023-12-12 09:15:28 -07:00
Tórur Zachariasen
d55843cecf
fix(react): skip adding comma to config when adding remote to host if… (#20620) 2023-12-12 15:15:55 +00:00
Jack Hsu
507fe42e4f
feat(webpack): add plugin to automatically configure build and serve targets (#20243) 2023-11-28 13:01:03 -05:00
Emily Xiong
21e952f37e
fix(react): remote url port depends on serve target (#20417) 2023-11-27 17:33:37 -05:00
Colum Ferry
a73e9fd562
feat(module-federation): use single file-server for static remotes (#20006) 2023-11-10 11:25:09 -05:00
Nicholas Cunningham
022f1ea355
fix(react): Update error message for invalid remote name (#19744) 2023-10-23 11:09:22 -04:00
Nicholas Cunningham
8ccd88cfcb
feat(react): Add federate-module generator (#19286) 2023-10-06 14:54:29 -06:00
Nicholas Cunningham
0369224b1c
feat(react): Support loading remotes via library: var (#19192) 2023-09-19 09:10:26 -06:00
Nicholas Cunningham
0a7efc6465
feat(react): Add versioning for workspace libraries (#19063) 2023-09-14 08:08:46 -04:00
Colum Ferry
dd5ea7a244
feat(webpack): move module federation utils to webpack (#18996) 2023-09-08 10:22:09 -04:00
Colum Ferry
1891addc09
fix(react): mf should consider ssl when setting remote urls #16989 (#17746) 2023-06-23 14:15:32 +01:00
Colum Ferry
9d71c718f0
fix(react): skip DefinePlugin for SSR (#16612) 2023-04-27 15:15:08 +00:00
fyodorovandrei
6dd1385eca
feat(react): refactor util getModuleFederationConfig to avoid to pass function to determinate the remote url (#16488)
Co-authored-by: Colum Ferry <cferry09@gmail.com>
2023-04-27 08:22:17 -04:00
Colum Ferry
f34fec319f
fix(core): deprecate mf utils from devkit public api (#16574) 2023-04-26 17:36:09 -04:00
Emily Xiong
840048480f
feat(core): update create-nx-plugin to generate cli library (#15994) 2023-04-19 20:36:11 -04:00
Jason Jean
76dfc62412
feat(web): replace usages of @nrwl with @nx (#16376) 2023-04-19 10:59:41 -04:00
Miroslav Jonaš
2dd59c3b57
feat(core): extract js related code from affected and hasher (#16244) 2023-04-18 10:42:05 -04:00
Jason Jean
2d195007b0
feat(core): switch packages to use the @nx scope (#16069) 2023-04-14 19:56:37 -04:00
Dmitry Marcautan
432e07440e
fix(misc): shared deps that rely on default configuration are filtered out (#16193)
Co-authored-by: Dmitry Marcautan <dmitry.marcautan@infopulse.com>
2023-04-11 13:51:13 +03:00
Leosvel Pérez Espinosa
5c33797040
fix(misc): filter shared libraries by import name in module federation helpers (#15980) 2023-03-31 15:45:28 +01:00
Leosvel Pérez Espinosa
e2a27039c0
fix(misc): filter out deps early based on shared config from module federation (#15654) 2023-03-14 11:34:49 +00:00
Ruben Casas
c05425104e
fix(react): fixes library type not passed to the module federation conf (#15385) 2023-03-02 19:49:01 +02:00
Jason Jean
fa6e8ea987
fix(js): refactor ensurePackage (#15074) 2023-02-22 18:47:40 -05:00
Emily Xiong
a97212b601
feat(core): move tsconfig.base.json to @nrwl/js:init (#14467) 2023-02-16 11:17:30 -05:00
Jack Hsu
ec28689a80
docs(webpack): add guide for webpack plugins (e.g. withNx, withWeb, etc.) (#14720) 2023-01-31 17:06:32 +00:00
Jack Hsu
795e4d6985
fix(webpack): fix support for module federation plugin (#14653) 2023-01-27 14:14:31 +02:00
Victor Savkin
422c8c735a cleanup(core): clearly split nx.json config and projects config 2023-01-05 15:35:36 -05:00
Jack Hsu
2392b916c4
fix(react): use correct setup for React SSR with module federation (#13822) 2022-12-14 10:37:55 -05:00
Colum Ferry
62fc986609
fix(react): fix target to use for serve-ssr remote detection (#13709) 2022-12-08 08:32:17 -05:00
Colum Ferry
8be2980339
feat(react): add withModuleFederationForSSR function (#13276) 2022-11-22 12:16:20 +00:00
Miroslav Jonaš
ab6f62a9b5
feat(core): move runtime-lint-utils to eslint plugin (#13222) 2022-11-18 12:24:53 +01:00
Colum Ferry
efc100587b
feat(react): remove exposed utils (#13079) 2022-11-09 11:20:21 +00:00
Colum Ferry
40a2d655c2
feat(devkit): extract more common module federation logic (#13066) 2022-11-09 09:37:14 +00:00
Colum Ferry
000eebdbe1
feat(react): use shared helpers from devkit (#13061) 2022-11-08 16:36:36 +00:00
Ruben Casas
1992adad38
fix(react): fix minification for prod builds in with-module-federation (#12680) 2022-10-26 10:01:05 +01:00
Wenchen Li
ba657da7c5
fix(webpack): regression from #10432 to allow // prefix in remote (#12302) 2022-09-29 16:16:50 +01:00
Jack Hsu
4b491c86f2
fix(web): update http-server lookup so it works with pnpm (#12269) 2022-09-28 09:37:35 -04:00
Jack Hsu
2c8a711c69
feat(react): improve types for module federation config file (#11476) 2022-08-06 02:31:59 +00:00
Leosvel Pérez Espinosa
23d94a82d0
fix(misc): handle external nodes correctly in module federation additional shared config (#11018) 2022-07-05 14:21:19 +01:00
Craigory Coppola
5b90514008
feat(core): move workspace configuration computation to daemon (#10860) 2022-06-24 09:45:51 -04:00
Victor Savkin
e491c6f738 feat(core): make nx.json optional 2022-05-31 15:35:28 -04:00
Colum Ferry
a299469925
feat(angular): support alternate remote entry filenames #10206 (#10432) 2022-05-24 12:16:33 +01:00
Leosvel Pérez Espinosa
425adf1d00
feat(react): add support for passing additional shared dependencies in the module federation config (#10169) 2022-05-09 09:00:31 -04:00