Skip to content

[Bug]: SVG imports with same filename as JS import cause issues in bundleless #1007

@dstaley

Description

@dstaley

Version

System:
    OS: macOS 15.5
    CPU: (12) arm64 Apple M3 Pro
    Memory: 117.19 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 136.0.7103.114
    Safari: 18.5
  npmPackages:
    @rslib/core: ^0.8.0 => 0.8.0

Details

In bundleless mode, if an SVG import uses the same filename as a JavaScript import, the resulting bundle replaces the JS import with the SVG import, resulting in broken output.

In the reproduction, there is a organization.svg file and an organization.js file. The organization.svg is imported in icons/index.js, and the organization.js file is imported in utils/index.js. However, after building, you'll see that the resulting utils/index.js file imports from utils/organization.js, but exports that under __webpack_modules__['./organization.svg']. This means that the expected isOrganizationId isn't exported at all.

Reproduce link

https://github.com/dstaley/rslib-svg-issue

Reproduce Steps

  1. pnpm build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions