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

add option to exclude shared dependencies from build #2795

Open
2 tasks done
tky753 opened this issue Jul 25, 2024 · 0 comments
Open
2 tasks done

add option to exclude shared dependencies from build #2795

tky753 opened this issue Jul 25, 2024 · 0 comments

Comments

@tky753
Copy link

tky753 commented Jul 25, 2024

Clear and concise description of the problem

I use rsbuild for building, and want to minimize my remote module size,
so I don't want shared dependencies generated on remotes as I can load it from my host.
I tried these config in rsbuild.config.ts:

import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'
......
  output: {
    externals: ["react"]
  },
  tools: {
    rspack: (config, { appendPlugins }) => {
      appendPlugins([
        new ModuleFederationPlugin({
          shared: {
            react: { singleton: true }
          }
       })
    }
  }

but where I run rsbuild build, shared react is still generated at:
dist\static\js\async\lib-react.e00de504.js

Suggested solution

add ModuleFederationPluginOptions options:

/* exclude shared dependencies from build, default: false */
external?:  boolean

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant