web-infra-dev / rsbuild

The Rspack-based build tool. It's fast, out-of-the-box and extensible.
https://rsbuild.dev/
MIT License
1.7k stars 134 forks source link

[Bug]: After moduleFederation is turned on, polyfill does not take effect. #3593

Open nanianlisao opened 4 weeks ago

nanianlisao commented 4 weeks ago

Version

latest

Details

The minimum configuration is as follows:

moduleFederation: {
    options: {},
  },
  output: {
    polyfill: 'entry',
    overrideBrowserslist: ['chrome 70'],
  },

At this time, corejs injection does not take effect.

In addition, this seems to be a problem with rspack, webpack is ok

Reproduce link

no

Reproduce Steps

no

github-actions[bot] commented 4 weeks ago

Hello @nanianlisao. Please provide a reproduction repository or online demo. For background, see Why reproductions are required. Thanks ❤️

chenjiahan commented 4 weeks ago

You can find the core-js code in this chunk:

image

The default lib-polyfill chunk will not be generated when using moduleFederation.options, see https://rsbuild.dev/config/module-federation/options

image

nanianlisao commented 4 weeks ago

@chenjiahan You need to run it under chrome 70, and then the following error will appear.

image

The problem is that the polyfill does not take effect, not the splitChunk rule.