originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.39k stars 241 forks source link

Adding and then removing `manualChunks` causes runtime error #569

Open echjordan0 opened 9 months ago

echjordan0 commented 9 months ago

Versions

Reproduction

Additional Details

Steps to reproduce

  1. Add a manual chunk in the remote's Vite config (it does not seem library specific but I was chunking a PDF library) and build
      rollupOptions: {
        output: {
          manualChunks: {
            'vue-pdf-embed/dist/vue2-pdf-embed': ['vue-pdf-embed/dist/vue2-pdf-embed'],
          },
        },
      },
  2. Later remove this piece of the config bc you no longer want to create a separate chunk Screenshot 2024-02-13 at 5 42 14 PM
  3. Build for production
  4. Try to fetch the remote receive the following error: Screenshot 2024-02-13 at 5 44 56 PM

Interestingly, I can work around this error by changing the config to

     rollupOptions: {
        output: {
          manualChunks: {},
        },
      },

But it seems very strange that I'd need to do so. Perhaps it's not properly cleaning up the options when they're removed entirely?

Thank you!

What is Expected?

What is actually happening?