Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add storybook addon that supports Module Federation remote containers #598

Conversation

fyodorovandrei
Copy link
Contributor

Fix for issue #532

@fyodorovandrei fyodorovandrei changed the title [WIP] Features: Add storybook plugin that supports Module Federation remote containers [WIP] feat: add storybook plugin that supports Module Federation remote containers Feb 23, 2023
@pavandv pavandv force-pushed the features/add-storybook-plugin branch from 996dcbd to 87c8eb4 Compare February 24, 2023 04:55
@ScriptedAlchemy
Copy link
Member

Are you planning to publish this package to npm?

@fyodorovandrei
Copy link
Contributor Author

@ScriptedAlchemy Yes

@fyodorovandrei fyodorovandrei changed the title [WIP] feat: add storybook plugin that supports Module Federation remote containers [WIP] feat: add storybook addon that supports Module Federation remote containers Mar 3, 2023
@fyodorovandrei fyodorovandrei changed the title [WIP] feat: add storybook addon that supports Module Federation remote containers feat: add storybook addon that supports Module Federation remote containers Mar 3, 2023
…into features/add-storybook-plugin

# Conflicts:
#	package.json
@fyodorovandrei
Copy link
Contributor Author

I'm blocked by a bug. I sent a message in the Storybook Discord channel. I would really appreciate if you can someone help me.

…into features/add-storybook-plugin

# Conflicts:
#	.github/workflows/release.yml
#	nx.json
#	package.json
#	yarn.lock
@fyodorovandrei
Copy link
Contributor Author

Surely I was wrong with NX something to configure, but it's ready for review @ScriptedAlchemy

packages/storybook-addon/package.json Outdated Show resolved Hide resolved
workspace.json Outdated Show resolved Hide resolved
…into features/add-storybook-plugin

# Conflicts:
#	package.json
…into features/add-storybook-plugin

# Conflicts:
#	package.json
@@ -136,4 +152,3 @@
]
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Code review:

  1. The patch introduces a number of new dependencies, such as "@nrwl/storybook", "@pmmmwh/react-refresh-webpack-plugin", "@storybook/addon-essentials", "@svgr/webpack", "babel-jest", "babel-loader", "html-webpack-plugin", "react-refresh", "url-loader" and "webpack-virtual-modules". It is necessary to check if these new dependencies are properly added and do not introduce any security risks.

  2. The patch also updates some existing dependencies, such as "@nrwl/linter", "@nrwl/next", "@swc/cli" and "typescript". It is necessary to ensure that these updated dependencies are compatible with the application and do not break any of its functionality.

  3. It is important to check if the patch does not introduce any syntax errors and that all the changes are properly tested.

  4. It is also necessary to make sure that the patch does not introduce any performance issues or memory leaks.

@zackarychapple zackarychapple merged commit 7547b02 into module-federation:main Apr 25, 2023

const { ModuleFederationPlugin } = container;

function determineRemoteUrl(remote: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we export these functions to be reused lately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I open a PR to refactor getModuleFederationConfig util. It will no longer be necessary to pass the function determineRemoteUrl. When will it be merged I will create a PR to remove the function

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fyodorovandrei love that <3 Thanks 🙏

@fyodorovandrei fyodorovandrei deleted the features/add-storybook-plugin branch July 17, 2023 08:13
RussellCanfield pushed a commit to RussellCanfield/nextjs-mf that referenced this pull request Aug 26, 2023
…ainers (module-federation#598)

* feat: add package storybook-plugin

* feat(storybook-plugin): add test for webpack fn

* feat: add package storybook-plugin

* feat(storybook-plugin): add test for webpack fn

* feat(storybook-plugin): remove storybook config overwrite

* feat(storybook-plugin): replace VirtualModulePlugin from storybook webpack config with another configuration to bootstrap entry file

* fix(storybook-plugin): update todo comment

* fix(storybook-plugin): remove preview file

* feat(storybook-plugin): move utils in own folder

* feat(storybook-plugin): update logic to replace or push the plugin VirtualModulePlugin

* feat(storybook-plugin): fix package description

* feat(storybook-plugin): update README.md

* feat(storybook-addon): rename from plugin to addon

* chore: add package storybook-addon in release action

* fix(storybook-addon): update package repository url

* fix(storybook-addon): update mock and add virtual module plugin after refactor webpack fn

* feat(storybook-addon): add tests for correctImportPath util

Co-authored-by: Robert Donnelly <dev@robdonn.com>

* feat(storybook-addon): refactor webpack fn

* feat(storybook-addon): write all webpack virtual modules in node_modules directory and fix some imports

* fix(storybook-addon): update test

* fix(storybook-addon): rollback yarn.lock

* feature(storybook-addon): write files recursive when move from virtual modules

* feat(storybook-addon): move util `correctImportPath` in common utils package

* feat(storybook-addon): add 2 mf apps and add support for nx mf config

* fix(storybook-addon): pass webpack config

* fix(storybook-addon): rollback util call

* feat(storybook-addon): implement custom utils `withModuleFederation` for nx Module Federation

* feat(storybook-addon): update package versions

* feat(storybook-addon): update README.md

---------

Co-authored-by: Zack Jackson <zackary.l.jackson@gmail.com>
Co-authored-by: Robert Donnelly <dev@robdonn.com>
Copy link
Contributor

🎉 This PR is included in version 1.0.0-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants