79366863

Date: 2025-01-18 09:39:32
Score: 2
Natty:
Report link

We did a similar migration only we migrated to rsbuild instead of rspack. Sice we also rely on react-intl and thus formatjs for internationalization we were facing a similar problem and if I am not mistaken we ran into the exact same or a similar error. We solved this by using @swc/plugin-formatjs using the following config in rsbuild.config (it should be very straightforward to apply this to rspack itself in a similar way):

...
tools: {
        swc: {
            jsc: {
                experimental: {
                    plugins: [
                        [
                            '@swc/plugin-formatjs',
                            {
                                idInterpolationPattern:
                                    '[folder]/[name].[ext]_[sha512:contenthash:base64:8]',
                                ast: true,
                            },
                        ],
                    ],
                },
            },
        },
    },
...

For us this currently only works with the 1.x.x version range of the @swc/plugins-formatjs plugin. At the moment any newer version we tried lead to a panic I described here: https://github.com/swc-project/swc/issues/5060. Other than that it seems to work fine.

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): facing a similar problem
  • Low reputation (1):
Posted by: momesana