callstack / repack

A Webpack-based toolkit to build your React Native application with full support of Webpack ecosystem.
https://re-pack.dev
MIT License
1.48k stars 110 forks source link

[HMRClient] Cannot find update - full reload needed #795

Open ra1nj opened 6 days ago

ra1nj commented 6 days ago

Describe the bug

I am trying out the Repack5.0 with the ModuleFederationPluginV2, i followed the super-app-showcase repo to configure my project. But i encountered a bug: once my mini-app loaded , the devServer of the mini-app says: [DevServer] File mini-app.233bb634f7c7647b.hot-update.json for android not found in compilation assets (no compilation in progress) ... the devServer of the host app says: [HMRClient] Cannot find update - full reload needed

Then the host app will do a fully reload, i never got the chance to render the mini-app.

System Info

None

Re.Pack Version

5.0.0-rc.1

Reproduction

None

Steps to reproduce

i'm not sure if the bug is caused by that i added babel-loader in the mini-app's rspack.config.mjs ,my mini-app relied on some babel plugin so configured the rule like following:

                 {
                    test: /\.[jt]sx?$/,
                    exclude: [/node_modules/],
                    type: 'javascript/auto',
                    use: [
                        {
                            loader: 'builtin:swc-loader',
                            /** @type {import('@rspack/core').SwcLoaderOptions} */
                            options: {
                                parseMap: true,
                                env: {
                                    targets: {
                                        'react-native': '0.74',
                                    },
                                },
                                jsc: {
                                    externalHelpers: true,
                                    transform: {
                                        react: {
                                            runtime: 'automatic',
                                            development: mode === 'development',
                                            refresh: mode === 'development' && Boolean(devServer),
                                        },
                                    },
                                },
                            },
                        },
                        {
                            loader: 'babel-loader',
                            // options: {
                            //     /** Add React Refresh transform only when HMR is enabled. */
                            //     plugins:
                            //         devServer && devServer.hmr
                            //             ? ['module:react-refresh/babel']
                            //             : undefined,
                            // },
                        },
                    ],
                },
ra1nj commented 6 days ago

Find a error before reloading: ✖ [01:38:34.549Z][Console] Warning: ReferenceError: Property 'exports' doesn't exist

jbroma commented 5 days ago

Hey, can you provide some details on what changes you've introduced to the config? Thanks!

ra1nj commented 5 days ago

I will try to make a reproduction repo