Skip to content

[SolidJS] Browser Main Fields override Export Conditions #10323

@ryansolid

Description

@ryansolid

Describe the bug

Expected Behavior

When an export condition matches it doesn't use the "browser" main field to remap it just because "browser" was set.

Actual Behavior

In our case it matches on "worker" and then gets upgraded to the "browser" version unexpectedly.

Additional Information

solidjs/solid-start#263 Lays out the issue.

This issue isn't only unexpected but it makes things very difficult. We have 3 things trying to balance:

  1. Server vs Browser runtimes are different for SolidJS
  2. Cloudflare Worker environments are Server environments for us but most tools call them browser, understandably because of Service/Web Workers. That's ok we can control this with export conditions.
  3. Browser mainfield support is necessary for legacy tooling support. But its existence causes the work we do to map workers to be undone.

All these seem unmoveable. But perhaps main field overriding export conditions is not. The linked issues shows our attempts at trying to fix this. And backlinks relevant Github issues.

Reproduction

https://github.com/patdx/solid-start-graphql-cloudflare/tree/main/solid-with-standard-adapter

System Info

System:
    OS: macOS 12.6
    CPU: (8) arm64 Apple M1
    Memory: 97.66 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Chrome: 105.0.5195.125
    Edge: 105.0.1343.53
    Firefox: 102.0.1
    Safari: 16.0

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-downstream-blockerBlocking the downstream ecosystem to work properly (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions