Skip to content

rolldown-vite iife output format with external dependencies produces non-working builds #451

@AlexanderYW

Description

@AlexanderYW

Describe the bug

Hi,

I'm currently working on a micro-frontend architecture using the iife output format. Our setup relies on a shared "shell" application that provides certain internal CSS dependencies, so we need those to be excluded from each micro-frontend build.

To achieve this, we're using rollupOptions / rolldownOptions within the build config to mark those dependencies as external. This works as expected when using Vite with Rollup, where the dependencies gets properly excluded.

When switching to rolldown-vite, it seems those external settings aren't being respected in the same way. As a result, our micro-frontends fail to initialize correctly, throwing errors related to the missing internal dependencies that should have been stripped out.

I wasn't able to make it work using rolldown repl or stackblitz, so I have created a MRR with the issue on my own git. https://github.com/AlexanderYW/rolldown-external-issue
There is only two files of interest, vite.config and main.ts, if there is any security concerns.

Also let me know if theres a workaround for this as well.

Reproduction

https://github.com/AlexanderYW/rolldown-external-issue

Steps to reproduce

  • Install dependencies (npm install)
  • Run build (npm run build)
  • Go to build folder (/build)
  • Notice line 18 in build/index.js contains references to the dependencies that should have been stripped out. (the dependencies are imported inside of src/main.ts)

System Info

System:
    OS: macOS 26.0.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 144.30 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.18.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.9.3 - /usr/local/bin/npm
    pnpm: 9.12.3 - /usr/local/bin/pnpm
    bun: 1.2.22 - /usr/local/bin/bun
  Browsers:
    Edge: 141.0.3537.71
    Safari: 26.0.1
  npmPackages:
    rolldown-vite:  7.1.14

Used Package Manager

npm

Logs

Click to expand logs! ```shell > [email protected] build > tsc && vite -c vite.config.ts build

rolldown-vite v7.1.14 building for production...
✓ 7 modules transformed.
build/index.html 0.43 kB │ gzip: 0.27 kB
build/index.css 1.20 kB │ gzip: 0.62 kB
build/index.js 4.26 kB │ gzip: 1.94 kB │ map: 5.16 kB
[MISSING_GLOBAL_NAME] Warning: No name was provided for external module "@fontsource/fira-sans/400.css" in "output.globals" – guessing "__fontsource_fira_sans_400_css".

[MISSING_GLOBAL_NAME] Warning: No name was provided for external module "@fontsource/fira-sans/400-italic.css" in "output.globals" – guessing "__fontsource_fira_sans_400_italic_css".

✓ built in 46ms

</details>

### Validations

- [x] Follow our [Code of Conduct](https://github.com/vitejs/rolldown-vite/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [Contributing Guidelines](https://github.com/vitejs/rolldown-vite/blob/main/CONTRIBUTING.md).
- [x] Read the [docs](https://vite.dev/guide) and the [Rolldown-related guide](https://main.vite.dev/guide/rolldown.html).
- [x] Check that there isn't [already an issue](https://github.com/vitejs/rolldown-vite/issues) that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/rolldown-vite/discussions) or join our [Discord Chat Server](https://chat.vite.dev/).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions