Module federation - readable chunk names in Production builds?

143 views Asked by At

I have the following Webpack config for exposing modules via Module Federation:

...
  filename: 'remoteEntry.js',
  exposes: {
    './MainLayout': { import: './src/core/MainLayout', name: 'MainLayout' },
....
  output: {
    filename: configUtils.appJsFileName,
    chunkFilename: pathData => {
      return pathData.chunk.name && pathData.chunk.name.startsWith('main')
        ? configUtils.appJsChunkFileName
        : `chunks/${configUtils.appJsChunkFileName}`;
    },
}.
...

(the value of appJsChunkFileName is '[name].[contenthash].chunk.min.js',)

When i run Webpack dev-server, the chunks show up in the browser Network panel with readable names such as MainLayout.48fj9d.js, however in Production builds it just shows up as 94948.sjd8j.js.

How can i fix it?

0

There are 0 answers