<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zackary Chapple</title>
    <description>The latest articles on DEV Community by Zackary Chapple (@zchapple).</description>
    <link>https://dev.to/zchapple</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F176389%2F5efcb669-1088-4d8e-b3c4-ea6928cfdd10.jpg</url>
      <title>DEV Community: Zackary Chapple</title>
      <link>https://dev.to/zchapple</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zchapple"/>
    <language>en</language>
    <item>
      <title>Extreme build performance NestJS: Leveraging Rspack and Nx while working to increase build performance for NestJS applications</title>
      <dc:creator>Zackary Chapple</dc:creator>
      <pubDate>Fri, 12 May 2023 14:29:57 +0000</pubDate>
      <link>https://dev.to/valorsoftware/extreme-build-performance-nestjs-leveraging-rspack-and-nx-while-working-to-increase-build-performance-for-nestjs-applications-4ge1</link>
      <guid>https://dev.to/valorsoftware/extreme-build-performance-nestjs-leveraging-rspack-and-nx-while-working-to-increase-build-performance-for-nestjs-applications-4ge1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Atlanta, Georgia - May 12th, 10am Eastern Today&lt;/strong&gt;, &lt;a href="https://valor-software.com/"&gt;Valor Software&lt;/a&gt; together with &lt;a href="https://nx.dev/"&gt;Nx&lt;/a&gt; and &lt;a href="https://rosa.be/"&gt;Rosa&lt;/a&gt; are announcing &lt;a href="//rspack.dev"&gt;Rspack&lt;/a&gt; support for &lt;a href="https://nestjs.com/"&gt;NestJS&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Hospitals and healthcare professionals trust Rosa to manage their schedule and appointments. Patients rely on Rosa to book their medical appointments. As a mission critical company in the business of saving lives, we know that even a single moment of downtime can be devastating. Every second matters! A production downtime incident that is waiting for builds that take 15+ minutes is simply unacceptable when people's lives are at stake. As such we are constantly looking for ways to improve our build process&lt;/p&gt;

&lt;p&gt;Cherry on the cake: it also improves the DX.&lt;/p&gt;

&lt;p&gt;When we saw the Rspack &lt;a href="https://valor-software.com/press-release/rs-pack-rust-based-web-bundler"&gt;announcement&lt;/a&gt; by Valor in March we knew we wanted to see if Rspack could improve our builds. We engaged with them to fund this project.” &lt;strong&gt;- Antoine Pairet: Founder and CTO at Rosa&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rosa selected Valor Software to add NestJS support to Rspack via Nx and integrate it into their existing applications. After working in collaboration with the Nx team, Valor is excited to share that initial support and performance results are now available for release and testing by the wider community.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Building on our partnership with Valor Software and our existing integrations for Rspack added by our team last Month, it was a pleasure for us to collaborate on extending our support for NestJS.&lt;/p&gt;

&lt;p&gt;This project allowed us the opportunity to not only enhance our existing support for NestJS, but also to improve our existing integrations with Rspack.&lt;/p&gt;

&lt;p&gt;The performance is simply amazing and the ecosystem is wonderful to work with” &lt;strong&gt;- Katerina Skroumpelou: Senior Software Engineer at Nx&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With over 56k stars on &lt;a href="https://github.com/nestjs/nest"&gt;GitHub&lt;/a&gt; and over 2.2 million downloads a week on &lt;a href="https://www.npmjs.com/package/@nestjs/core"&gt;NPM&lt;/a&gt;, NestJS is an incredibly popular if not the default Node.js framework for developers in 2023. NestJS under the covers was leveraging webpack to conduct its builds and additionally supports a custom build configuration. This mechanism was used to add Rspack support for NestJS.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“When I created NestJS in 2017 I was working on it as a side project, during that time I wanted to create something that was scalable, efficient, and fully supported TypeScript. Since its creation NestJS has grown to be one of the most popular Node.js frameworks that I know of.&lt;/p&gt;

&lt;p&gt;When our partners at Valor reached out to us and mentioned they were going to work on adding Rspack support we were happy to see what progress they would make. After seeing the initial performance improvements we are thrilled to welcome Rspack to the possible ways to build NestJS” &lt;strong&gt;- Kamil Mysliwiec: Co-Founder Trilon and Creator of NestJS&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Results
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;“Migrating NestJS to Rspack is a part of an overall build process improvement project for Rosa. Thanks to Valor, we were was able to take our build times from roughly 30 minutes to 7 minutes in less than a month. After we pull through the remaining changes that are in progress we expect to be under 3 minutes for our full build on our CI pipeline. We are looking forward to share more details once we wrap it up.” &lt;strong&gt;- Antoine Pairet: Founder and CTO at Rosa&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Below are build time performance results for one of the projects converted to Rspack by Valor for the Rosa team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Webpack results
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Oevj5-na--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0k3trixspda5v6pgbo4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Oevj5-na--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0k3trixspda5v6pgbo4t.png" alt="Image description" width="800" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Rspack results
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CSJKB1Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tneuq0xf4p4pkhupcvq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CSJKB1Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tneuq0xf4p4pkhupcvq0.png" alt="Image description" width="800" height="122"&gt;&lt;/a&gt;&lt;br&gt;
There was a minor change to switch to the rspack “withNx” plugin in our webpack (now Rspack) config to ‘@nrwl/rspack’ and setting the project.json to use the executor ‘@nrwl/rspack:rspack’ and point to a ‘rspackConfig’ instead of a ‘webpackConfig’&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“After reviewing the configurations for the applications, there are improvements that could have been made within webpack itself to achieve a portion of the gains seen here with Rspack. However it requires combining in depth knowledge of webpack and an increase to the configuration that would then need to be maintained. With Rspack all of the optimizations and improvements came for “free” and just simply works. It is configured to be performant by default and there is a very small margin for error.” &lt;strong&gt;- Zack Jackson: Principal Architect at Lululemon and creator of Webpack Module Federation&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Try it today
&lt;/h1&gt;

&lt;p&gt;Install the Nx &lt;a href="https://www.npmjs.com/package/@nx/rspack"&gt;plugin&lt;/a&gt; today and try Rspack, Nx, and NestJS! We have a &lt;a href="https://github.com/valor-labs/nest-rspack-nx"&gt;simple example&lt;/a&gt; demonstrating how to use this powerful combination of technologies on GitHub.&lt;/p&gt;

&lt;h1&gt;
  
  
  Pending issues requiring further effort
&lt;/h1&gt;

&lt;p&gt;While the project itself and this release is considered a success there is still some work to be done to improve it. We would love any help with pull requests!&lt;/p&gt;

&lt;h2&gt;
  
  
  Rspack Issues:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Support ForkTSCheckerWebpackPlugin, &lt;a href="https://github.com/web-infra-dev/rspack/issues/2602"&gt;issue 2592&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Nx Issues:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Support FileReplacement option for Rspack projects, &lt;a href="https://github.com/nrwl/nx-labs/issues/218"&gt;issue 218&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support extractLicenses option for Rspack projects &lt;a href="https://github.com/nrwl/nx-labs/issues/218"&gt;issue 218&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support extractLicenses option for Rspack projects, &lt;a href="https://github.com/nrwl/nx-labs/issues/219"&gt;issue 219&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support maxWorkers option for Rspack projects, &lt;a href="https://github.com/nrwl/nx-labs/issues/224"&gt;issue 224&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support memoryLimit option for Rspack projects &lt;a href="https://github.com/nrwl/nx-labs/issues/225"&gt;issue 225&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Support generatePackageJson option Rspack projects, &lt;a href="https://github.com/nrwl/nx-labs/issues/225"&gt;issue 226&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  About Valor Software
&lt;/h1&gt;

&lt;p&gt;Founded in 2013 Valor Software is a leading software development and consulting company that specializes in advancing and bringing together open source technologies to achieve technological and business advancement for their customers. Valor brings a wealth of open-source experience to the table, having contributed to Module Federation as core team members, worked on Angular as contributors, and created &lt;a href="https://ngx-bootstrap.com/"&gt;ngx-bootstrap&lt;/a&gt; (an Angular component library with over 300 thousand downloads a week).&lt;/p&gt;

&lt;p&gt;If you’re looking to push the edge of development or would like to work with us to create something amazing please reach out via email, &lt;a href="mailto:sales@valor-software.com"&gt;sales@valor-software.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rspack</category>
      <category>webpack</category>
      <category>nx</category>
      <category>nestjs</category>
    </item>
    <item>
      <title>Rspack: The Rust-Based Web Bundler that Combines High Performance with Interoperability</title>
      <dc:creator>Zackary Chapple</dc:creator>
      <pubDate>Fri, 10 Mar 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/valorsoftware/rspack-the-rust-based-web-bundler-that-combines-high-performance-with-interoperability-45m8</link>
      <guid>https://dev.to/valorsoftware/rspack-the-rust-based-web-bundler-that-combines-high-performance-with-interoperability-45m8</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh01w9l1j56qlwjsk2au7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh01w9l1j56qlwjsk2au7.png" alt="Rspack Announcement Image with Rocket"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Atlanta, Georgia - March 9, 2023, 7 PM Eastern&lt;/strong&gt; -- Today, &lt;a href="https://www.bytedance.com/" rel="noopener noreferrer"&gt;ByteDance&lt;/a&gt; ( the tech giant behind popular platforms such as TikTok and Douyin) and &lt;a href="https://valor-software.com/" rel="noopener noreferrer"&gt;Valor Software&lt;/a&gt; introduced &lt;a href="https://rspack.dev/" rel="noopener noreferrer"&gt;Rspack&lt;/a&gt; to the open source community.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Our early benchmarks of Rspack are very promising: it starts and compiles app.netlify.com (our primary user-facing web application) 300 to 500% faster than Webpack 5 with ESBuild.&lt;br&gt;
We can’t wait to see Rspack also make it to the hands of Netlify customers and speed up their development workflows!" &lt;/p&gt;

&lt;p&gt;Kaelig Deloumeau-Prigent - Principal software engineer at Netlify&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rspack offers developers a new and innovative solution for web bundling, combining multi-threaded high performance with webpack interoperability. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The team at Valor Software has been instrumental in our journey to open-source Rspack, Their connections within the open-source community and ability to bring organizations together are unparalleled."&lt;/p&gt;

&lt;p&gt;Lei Zhang - Manager of the platform team at ByteDance&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With the collaboration between ByteDance's internal platform development team and Valor Software, a new era of web development efficiency is upon us, web development is becoming truly efficient. Rspack - a high-performance web bundler written in Rust, designed to be interoperable with webpack is being introduced to the open source community.&lt;/p&gt;

&lt;p&gt;In the world of Open Source, optimizing for community adoption and lowering the barrier of entry for developers is extremely important. Valor Software understood this and started collaborating with Nx, an open-source developer tool, downloaded more than 3 million times a week as per NPM stats. Nx provides powerful scaffolding mechanisms and features, allowing it to help teams scale large codebases and monorepos. Their reach and approach to improving the developer experience when adopting new tech stacks will help increase the adoption of Rspack across the community. &lt;/p&gt;

&lt;p&gt;As of today both React, and Solid have been tested and are compatible with Rspack.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;”Our primary goal at Nx is to be the premier developer CLI tool for managing JavaScript projects and promoting efficient team practices. As such we do not only provide powerful plugins developed by our team, but also empower framework authors to leverage Nx as their CLI.&lt;br&gt;
That’s why when ByteDance and Valor reached out, we were excited to work with them to develop a dedicated Rspack plugin for Nx. The plugin enhances the Rspack ecosystem and makes it easier for developers to adopt it and create production-ready applications.&lt;br&gt;
We are excited to continue working with the Rspack team to make sure the JavaScript community gets the best tools for modern development."&lt;/p&gt;

&lt;p&gt;Juri Strumpflohner - Senior Director of Developer Experience at Nx&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  About Valor Software
&lt;/h2&gt;

&lt;p&gt;Founded in 2013 Valor Software is a leading software development and consulting company that specializes in advancing and bringing together open source technologies to achieve technological and business advancement for their customers. Valor brings a wealth of open-source experience to the table, having contributed to Module Federation as core team members, worked on Angular as contributors, and created ngx-bootstrap (an Angular component library with over 300 thousand downloads a week).&lt;/p&gt;
&lt;h2&gt;
  
  
  "First Look" video
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rgLMfSYpn5s"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>rspack</category>
      <category>webpack</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Modernization with Module Federation, Nx and React</title>
      <dc:creator>Zackary Chapple</dc:creator>
      <pubDate>Tue, 03 Jan 2023 19:08:02 +0000</pubDate>
      <link>https://dev.to/zchapple/modernization-with-module-federation-nx-and-react-4kj5</link>
      <guid>https://dev.to/zchapple/modernization-with-module-federation-nx-and-react-4kj5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Many organizations are talking about how they are launching a modernization effort, but it seems as some organizations are struggling to move to React 18. It can be a challenge to get product teams to prioritize the upgrade from 16 or 17. &lt;/p&gt;

&lt;p&gt;There is a modernization strategy that can help make the transition without causing disruptions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Modernize in the first place?
&lt;/h3&gt;

&lt;p&gt;There are several reasons why an organization should upgrade to React 18, beyond the basic fact that React 15 and 16 are no longer receiving security patches from the React team. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance, with each new version of React, performance increases. Users are demanding more snappiness, additionally SEO is becoming even more top of mind for many organizations. Performance gains and the revenue they can potentially generate are a huge driving factor. &lt;/li&gt;
&lt;li&gt;Developer productivity, moving outside of the current major version leads to a large decrease in availability of maintained third party packages. Most large OSS libraries support n-1 (current major version minus one), so the moment a team gets outside of that range they risk being deprecated and having to support the package on their own. &lt;/li&gt;
&lt;li&gt;New Features, for organizations using SSR in particular the server side suspense that comes with React 18 is a real boost for performance and reduction in code complexity. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Strategy
&lt;/h3&gt;

&lt;p&gt;Most of the organizations that we work with are rather large enterprises. Their development efforts typically consist of multiple teams, multiple backlogs, and multiple, sometimes competing, priorities. Trying to land complicated upgrades takes a rather large amount of effort just in coordination. This has an impact on overall delivery velocity as well since it distracts from feature work. &lt;/p&gt;

&lt;p&gt;We need to work in a way that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easily repeatable&lt;/li&gt;
&lt;li&gt;Automated&lt;/li&gt;
&lt;li&gt;Scalable&lt;/li&gt;
&lt;li&gt;Non-disruptive&lt;/li&gt;
&lt;li&gt;Incremental &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick note regarding supported stacks
&lt;/h3&gt;

&lt;p&gt;While the main stack being mentioned in this article is React, it is important to mention that Module Federation as a strategy can be used with other frontend stacks; Angular, Next.js, Vue as well in Mobile with ReactNaive and NativeScript and backends with Node or Node with NestJS. &lt;/p&gt;

&lt;h2&gt;
  
  
  Decomposing and strategizing
&lt;/h2&gt;

&lt;p&gt;When starting a modernization effort that involves frontend development, one of the table stakes for Valor Software in its modernization efforts is the use of Nx.  &lt;/p&gt;

&lt;p&gt;Too often when working with an organization there are undocumented requirements, configurations spread throughout the organization, or just high levels of repetitive boilerplate. One of the first things we do in an organization is create a series of generators based on their current architecture best practices. &lt;/p&gt;

&lt;p&gt;ESLint configs, docker compose configs, sonar-cube, whatever they may be using, we take it and wrap it into a nice enterprise workspace generator tailored to their specific needs.&lt;/p&gt;

&lt;p&gt;Having organizational consistency, particularly at the onset of a modernization effort helps ease the adoption curve later on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is Nx table stakes
&lt;/h3&gt;

&lt;p&gt;Changing methodologies is inherently challenging, while many developers will be able to adopt quickly, others benefit greatly from having guardrails. Codifying the existing architecture best practices allow for organizations to understand how those are evolving over time. &lt;/p&gt;

&lt;h3&gt;
  
  
  Creating incremental demos
&lt;/h3&gt;

&lt;p&gt;Often organizations have their own, boutique, combinations of technologies they have built their application architecture ecosystem around. An organization using React 16 with Loadable Components, Apollo Client all requiring SSR and backed by Enzyme tests and built with Make is going to have some adventures moving to React 18 for a multitude of reasons. &lt;/p&gt;

&lt;p&gt;Creating incremental demos allows the team to start with the working reference architecture. These demos start by following the current organizational standards, with all of their niche complexities. Once the Nx workspace is able to generate that reference architecture properly the organization now has its starting point for each of the next stages of platform evolution. &lt;/p&gt;

&lt;p&gt;Nx shines again in the aspect that after the reference architecture can be generated, so can the migrations. For the most part the changes needed to add Module Federation to a React application is a known quantity. Which configurations to add, where to add them and which things to test afterwards is also known. With the reference architecture created Nx migrations to perform these known operations. For those unfamiliar, Nx migrations work a bit like code mods on steroids. &lt;/p&gt;

&lt;p&gt;Each migration becomes increasingly more challenging but also reveals more value to the platform. Typically Valor sees the following steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move to Webpack 5&lt;/li&gt;
&lt;li&gt;Add Module Federation&lt;/li&gt;
&lt;li&gt;Create an application shell with target technology stack and methodologies that wraps the existing React 16 application and still loads them with an adaptor&lt;/li&gt;
&lt;li&gt;Migrate federated remotes to React 17 (this may be skipped sometimes)&lt;/li&gt;
&lt;li&gt;Migrate federated remotes to React 18&lt;/li&gt;
&lt;li&gt;Refactor SSR implementations to begin to use Suspense&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most times there is also a migration to Typescript during one of these stages. This helps quite a bit with testability and reusability overall while also boosting developer productivity. &lt;/p&gt;

&lt;h3&gt;
  
  
  Power of Module Federation with an Application Shell
&lt;/h3&gt;

&lt;p&gt;Adding an Application Shell around the existing application, then added module federation gives teams greater freedom. With this combination they are now able to incrementally upgrade each of the federated remotes with higher relative autonomy. This allows the team to decide how to prioritize migrating the rest of the application. With clear communication patterns and backwards compatibility in place the efforts required to coordinate are significantly lower. &lt;/p&gt;

&lt;h2&gt;
  
  
  Long term benefits
&lt;/h2&gt;

&lt;p&gt;Architecture standards change, design systems get updated, and as with all software breaking changes are always potentially around the corner. By leveraging an enterprise Nx workspace those change can be propagated throughout the enterprise with a single command, which can also be automated. &lt;/p&gt;

&lt;p&gt;With the new Nx workspaces and usage of caching builds also become dramatically faster (typically on an order of 10-100x). We saw one customer's builds go from zero cache-ability and taking 90+ minutes to run, to high cache-ability around 300-600 milliseconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  We can help!
&lt;/h2&gt;

&lt;p&gt;Valor Software has worked with multiple organizations now begin this migration process and the results are, to put it blunt, astonishing. As partners with the team behind Nx, Nrwl, and the exclusive partners for Module Federation, we would love the opportunity to share specific details on how we can help your organization move to React 18 and Module Federation, &lt;a href="https://calendly.com/zack-chapple/module-federation-intro"&gt;schedule&lt;/a&gt; a call today!&lt;/p&gt;

</description>
      <category>react</category>
      <category>modulefederation</category>
      <category>nx</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Module Federation for the Business</title>
      <dc:creator>Zackary Chapple</dc:creator>
      <pubDate>Tue, 20 Dec 2022 20:31:21 +0000</pubDate>
      <link>https://dev.to/valorsoftware/module-federation-for-the-business-1ok6</link>
      <guid>https://dev.to/valorsoftware/module-federation-for-the-business-1ok6</guid>
      <description>&lt;h2&gt;
  
  
  What is Module Federation
&lt;/h2&gt;

&lt;p&gt;Module Federation is a technique that allows developers to split a large web application into smaller, independent modules that can be loaded on demand. The concept of Module Federation was first introduced by &lt;a href="https://www.linkedin.com/in/zackary-jackson-81845a35/"&gt;Zack Jackson&lt;/a&gt;. He later wrote a book on &lt;a href="https://module-federation.myshopify.com/products/practical-module-federation"&gt;Practical Module Federation&lt;/a&gt; written together with &lt;a href="https://www.linkedin.com/in/jherr/"&gt;Jack Herrington&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Module Federation works by using a "host" application that is responsible for loading and managing the various modules. The host application loads the modules asynchronously and communicates with them using a shared interface. This allows the modules to interact with each other and share data and functionality.&lt;/p&gt;

&lt;p&gt;Module Federation is a relatively new technology that is gaining popularity among developers as it allows for more modular, performant, and scalable web applications. It is not specific to any frontend framework and can be used with popular frameworks such as Next.js, React, Angular, and Vue. In addition, module Federation can also be used with Node.js itself for Federation of server code.&lt;/p&gt;

&lt;p&gt;In this blog post, we will be discussing the business value of Module Federation. Specifically, we will look at how modularity and scalability can benefit businesses by reducing development time and costs, improving maintainability and flexibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some of the business values and impacts
&lt;/h2&gt;

&lt;p&gt;Module Federation allows for more modular and scalable web applications by enabling developers to break down a large codebase into smaller, reusable pieces that can be loaded and updated separately. This flexibility and ability to ship code allows developers to work on individual parts of the application independently, which can reduce development time and costs. It also reduces risk due to the fact that smaller segments of functionality can be tested as functionality is being deployed.&lt;/p&gt;

&lt;p&gt;In addition, the modularity of Module Federation can also improve the maintainability and flexibility of the application. Because each module is self-contained and has its own dependencies, it is easier to update and maintain individual modules without affecting the rest of the application. &lt;/p&gt;

&lt;p&gt;Module Federation can also increase developer autonomy by allowing developers to work on their own modules without having to coordinate with the rest of the team as they did when working with monolithic applications. This can lead to faster development and a more efficient workflow.&lt;/p&gt;

&lt;p&gt;The resilience of the application is also increased by allowing portions of the web application to be unavailable without impacting the entire application. This can be particularly useful for applications that need to be highly available, as it allows for better handling of outages and maintenance.&lt;/p&gt;

&lt;p&gt;Finally, Module Federation often reduces the bundle size of the application by reducing the amount of code that needs to be shipped to the browser on the first interaction. This can improve the performance of the application and can also be beneficial for search engine optimization (SEO) as it reduces the amount of code that needs to be parsed by the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who's using Module Federation
&lt;/h2&gt;

&lt;p&gt;There is public information available that many large and recognizable organizations are using Module Federation in their web applications. Some examples of well-known companies that have adopted Module Federation include PayPal, Best Buy, Lululemon, Semrush, Cloudflare, Epic Games, Business Insider, Box.com, Shopify, Adidas, Fidelity, Bytedance, and Chase. &lt;/p&gt;

&lt;p&gt;These companies have likely implemented Module Federation to achieve greater modularity and scalability in their web applications, which we can expect to contribute to the success of their web presence.&lt;/p&gt;

&lt;p&gt;It is worth noting that these are just a few examples of the many organizations that are using Module Federation. There are likely many other companies, both large and small, that are using Module Federation internally or externally in their web applications. This demonstrates the widespread adoption of Module Federation as a powerful tool for building modular and scalable web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;If a development organization is looking for a technique that allows developers to split a large, monolithic, web application into smaller, independent modules that can be loaded on demand, Module Federation is the way to go. The reduced development time and costs, improved maintainability and flexibility, increased developer autonomy, increased application resilience, and reduced bundle size are just the beginning of the benefits.&lt;/p&gt;

&lt;p&gt;As we've shared, Module Federation has already been adopted by many well-known organizations, and it is likely that more companies will adopt it in the future. &lt;/p&gt;

&lt;p&gt;It is clear that business should try to stay up-to-date with new technologies and begin to leverage Module Federation, we know it will help them to stay competitive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Need help?
&lt;/h2&gt;

&lt;p&gt;Valor Software is a software development and consulting company that specializes in helping businesses modernize their web platforms and leverage new technologies like Module Federation. As official partners for the Module Federation organization, Valor Software has extensive experience and expertise in implementing module federation for businesses of all sizes.&lt;/p&gt;

&lt;p&gt;By working with Valor Software, businesses can take advantage of the latest technologies and techniques to build modern web applications that are more adaptable to changing needs and demands while also ensuring best practices through unparalleled access to the creator and supporting maintainers of Module Federation itself.&lt;/p&gt;

&lt;p&gt;Reach out today if you have any questions &lt;a href="mailto:sales@valor-software.com"&gt;sales@valor-software.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>modulefederation</category>
      <category>modernization</category>
      <category>microfrontends</category>
      <category>webdev</category>
    </item>
    <item>
      <title>webpack Plugin written by ChatGPT</title>
      <dc:creator>Zackary Chapple</dc:creator>
      <pubDate>Fri, 16 Dec 2022 18:04:22 +0000</pubDate>
      <link>https://dev.to/valorsoftware/webpack-plugin-written-by-chatgpt-2lol</link>
      <guid>https://dev.to/valorsoftware/webpack-plugin-written-by-chatgpt-2lol</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;No matter what social media platform you are on if you follow the tech space, or any space for that matter, you are most likely seeing content about ChatGPT or even content generated by ChatGPT.  &lt;/p&gt;

&lt;p&gt;When it first came out a few weeks ago I played with it, thought it was pretty cool and had my kids start using it to write guided stories with ideas from their imagination. When combined with MidJourney AI generated art the overall experience was quite amazing. &lt;/p&gt;

&lt;p&gt;Last night seeing &lt;a class="mentioned-user" href="https://dev.to/scriptedalchemy"&gt;@scriptedalchemy&lt;/a&gt; share about his &lt;a href="https://www.linkedin.com/feed/update/urn:li:activity:7009395526903234560/"&gt;experiences&lt;/a&gt; with it I decided to try something a little more challenging.&lt;/p&gt;

&lt;p&gt;A lot of my focus lately is on ModuleFederation and webpack. I asked myself what could ChatGPT do with that combination and what would be fun to see. My prompts and directions will be in quote blocks.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Task
&lt;/h2&gt;

&lt;p&gt;The first question I asked the site:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;create a webpack plugin in typescript that wraps module federation and adds additional logging&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Below is the first reply:&lt;br&gt;
To create a webpack plugin in TypeScript that wraps module federation and adds additional logging, you can follow these steps:&lt;/p&gt;

&lt;p&gt;Create a new TypeScript project and install the necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; webpack webpack-cli typescript ts-loader
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a tsconfig.json file to configure the TypeScript compiler. In the compilerOptions object, set the module option to "commonjs" and the target option to "esnext". This will ensure that the generated JavaScript code is compatible with webpack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"module"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"commonjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"esnext"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a webpack.config.ts file to configure webpack. In the configuration object, set the mode option to "development" and add a resolve object to specify that webpack should resolve TypeScript files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extensions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.tsx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// Add other configuration options here&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the webpack.config.ts file, add a module object to specify that webpack should use the ts-loader to transpile TypeScript files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Other configuration options&lt;/span&gt;
  &lt;span class="na"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;tsx&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ts-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/node_modules/&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a src directory and add an entry point file, such as src/index.ts. This will be the file that webpack will use as the starting point for the build.&lt;/p&gt;

&lt;p&gt;In the webpack.config.ts file, add an entry object to specify the entry point file and a output object to specify the path and filename of the bundled JavaScript file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Other configuration options&lt;/span&gt;
  &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/index.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;__dirname&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/dist&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bundle.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the necessary dependencies for module federation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @module-federation/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the webpack.config.ts file, import the ModuleFederationPlugin from the @module-federation/client package and add it to the plugins array in the configuration object. You can also specify the remotes option to specify the remote modules that your application should be able to access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@module-federation/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  First issues
&lt;/h2&gt;

&lt;p&gt;You can see that the last code block is incomplete.  Sometimes on more lengthy requests the chat bot can time out, I tried, quite literally, asking it to keep going.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;keep going&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sure, here are the next steps:&lt;/p&gt;

&lt;p&gt;Create a TypeScript interface for the plugin's options. This will allow you to specify the options for the plugin when it is added to the plugins array in the webpack configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPluginOptions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Add options here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new class for the plugin that extends the ModuleFederationPlugin class and implements the apply method. In the apply method, you can wrap the ModuleFederationPlugin and add additional logging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@module-federation/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPluginOptions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./options&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="k"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPluginOptions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPluginOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Add additional logging here&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the webpack.config.ts file, import the ModuleFederationLoggingPlugin class and add an instance of it to the plugins array in the configuration object. You can also specify the options for the plugin by passing an object to the constructor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./module-federation-logging-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Other configuration options&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="c1"&gt;// Specify options here&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run webpack to build the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx webpack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! You have now created a webpack plugin in TypeScript that wraps module federation and adds additional logging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modifying the results
&lt;/h2&gt;

&lt;p&gt;Seeing what the results were it was quite verbose, but it does not follow the platform I usually like to use, &lt;a class="mentioned-user" href="https://dev.to/nrwl_io"&gt;@nrwl_io&lt;/a&gt;'s Nx. So I did a redirect on the conversation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;how can I simplify the steps by using Nx&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using Nx (Nrwl Extensions for Angular) can simplify the process of creating a webpack plugin in TypeScript that wraps module federation and adds additional logging. Nx is a set of open-source tools and libraries that can help you develop full-stack applications more efficiently.&lt;/p&gt;

&lt;p&gt;To use Nx to create a webpack plugin, follow these steps:&lt;/p&gt;

&lt;p&gt;Install the Nx CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @nrwl/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new Nx workspace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-nx-workspace my-workspace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Nx workspace, create a new library for the webpack plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx nx g @nrwl/workspace:lib module-federation-logging-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the library directory, create a tsconfig.json file to configure the TypeScript compiler. In the compilerOptions object, set the module option to "commonjs" and the target option to "esnext". This will ensure that the generated JavaScript code is compatible with webpack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"module"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"commonjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"esnext"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the library directory, create a new TypeScript file for the plugin, such as src/module-federation-logging-plugin.ts. In this file, create a new class for the plugin that extends the ModuleFederationPlugin class and implements the apply method. In the apply method, you can wrap the ModuleFederationPlugin and add additional logging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@module-federation/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="k"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Add additional logging here&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the libs/module-federation-logging-plugin/tsconfig.lib.json file, add a typeRoots field to specify the path to the TypeScript declaration files for the webpack and @module-federation/client packages. This will allow the TypeScript compiler to find the type definitions for these packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./tsconfig.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"outDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../../dist/out-tsc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"typeRoots"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"node_modules/@types"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"node_modules/@module-federation/client/node_modules/@types"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"include"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"src/**/*.ts"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the libs/module-federation-logging-plugin/src/index.ts file, export the ModuleFederationLoggingPlugin class. This will allow other projects in the Nx workspace to use the&lt;/p&gt;

&lt;h2&gt;
  
  
  Second timeout
&lt;/h2&gt;

&lt;p&gt;You can see that I received another timeout due to the length of the response. This time instead of just asking it to continue I tried to get it to pick back up from step 7 which was incomplete. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;repeat the content of step 7 and keep going&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sure, here is the content of step 7:&lt;/p&gt;

&lt;p&gt;In the libs/module-federation-logging-plugin/src/index.ts file, export the ModuleFederationLoggingPlugin class. This will allow other projects in the Nx workspace to use the plugin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./module-federation-logging-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are the next steps:&lt;/p&gt;

&lt;p&gt;In the Nx workspace, create a new application that will use the webpack plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx nx g @nrwl/angular:app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the necessary dependencies for module federation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @module-federation/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the apps/my-app/src/webpack.config.ts file, import the ModuleFederationLoggingPlugin class from the library and add an instance of it to the plugins array in the webpack configuration object. You can also specify the options for the plugin by passing an object to the constructor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@my-workspace/module-federation-logging-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Configuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Other configuration options&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="c1"&gt;// Specify options here&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run webpack to build the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx nx run my-app:build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! You have now used Nx to create a webpack plugin in TypeScript that wraps module federation and adds additional logging.&lt;/p&gt;

&lt;h2&gt;
  
  
  One more tweak
&lt;/h2&gt;

&lt;p&gt;Just to see how far I can go I wanted to add some documentation. No plugin is complete without documentation right? &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;can you add swagger documentation to the src/module-federation-logging-plugin.ts file&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To add Swagger documentation to the src/module-federation-logging-plugin.ts file, you can use Swagger annotations in the form of JSDoc comments. JSDoc is a documentation standard for JavaScript that is widely supported by tools like Swagger.&lt;/p&gt;

&lt;p&gt;Here is an example of how you can add Swagger documentation to the ModuleFederationLoggingPlugin class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@module-federation/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="cm"&gt;/**
 * A webpack plugin that wraps module federation and adds additional logging.
 *
 * @param {Object} options - The options for the plugin.
 * @param {string} options.remoteName - The name of the remote module.
 * @param {string} options.remoteType - The type of the remote module.
 * @param {string} options.remoteUrl - The URL of the remote module.
 */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationLoggingPlugin&lt;/span&gt; &lt;span class="k"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;Plugin&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;moduleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;compiler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Add additional logging here&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then use a tool like Swagger UI or ReDoc to generate a documentation website from the Swagger annotations. To do this, you will need to generate a Swagger JSON file from the annotations. There are various tools and libraries that can do this, such as swagger-jsdoc and swagger-ui-express.&lt;/p&gt;

&lt;p&gt;Here is an example of how you can use swagger-ui-express to generate a Swagger documentation website:&lt;/p&gt;

&lt;p&gt;Install the necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save&lt;/span&gt; swagger-ui-express swagger-jsdoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a swagger.js file with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swaggerUi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;swagger-ui-express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swaggerJSDoc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;swagger-jsdoc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Swagger definition&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swaggerDefinition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;openapi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;3.0.0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Module Federation Logging Plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1.0.0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A webpack plugin that wraps module federation and adds additional logging.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;servers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:3000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Options for the swagger-jsdoc library&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;swaggerDefinition&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;apis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/module-federation-logging-plugin.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Initialize the Swagger document&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swaggerSpec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;swaggerJSDoc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kr"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api-docs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;swaggerUi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;serve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;swaggerUi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;swaggerSpec&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your application's main file, such as index.js, require the swagger.js file and pass the express app instance to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;After about 5 minutes I have code that is pretty close to what I was expecting. It has more comments and guidance than I would have created on my own, and for the most part follows some pretty decent best practices.&lt;/p&gt;

&lt;p&gt;ChatGTP was able to accept redirects that were pretty technical in nature, with little context, and adjust the output appropriately. &lt;/p&gt;

&lt;p&gt;While not a replacement for a developer that is experienced this tooling and process can help to learn new frameworks, patterns and create functionality more rapidly. &lt;/p&gt;

&lt;p&gt;Combining highly skilled engineers with ChatGPT will in the near future (if not now) increase their velocity. Combining new engineers with ChatGPT will aid in their exposure to practices that they can then begin to understand and question in their learning journey. &lt;/p&gt;

&lt;p&gt;What exciting times we live in!&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>webpack</category>
      <category>modulefederation</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
