Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json exports ignores some conditions (@astrojs/compiler breaking) #2357

Closed
Tracked by #2450
paperdave opened this issue Mar 9, 2023 · 1 comment · Fixed by #3935
Closed
Tracked by #2450

package.json exports ignores some conditions (@astrojs/compiler breaking) #2357

paperdave opened this issue Mar 9, 2023 · 1 comment · Fixed by #3935
Labels
bug Something isn't working npm Something that relates to the npm-compatible client

Comments

@paperdave
Copy link
Collaborator

What version of Bun is running?

0.5.8

What platform is your computer?

No response

What steps can reproduce the bug?

Bun Docs show that package.json exports can define these fields.
image

It is missing import and require, where the former breaks importing @astrojs/compiler as it defines this for it's exports:

  "exports": {
    ".": {
      "browser": "./browser/index.js",
      "import": "./node/index.js",
      "default": "./browser/index.js"
    },
    ...
  },

And bun picks up browser, and ignores import.

node docs here define import, require, and node-addons which bun ignores. I've never seen that last one but it seems to have some extra logic where the first two can just be treated as a higher priority than browser.

Reproduction:

import {transform} from '@astrojs/compiler';
transform("");

What is the expected behavior?

Loading the node version of the astro compiler.

What do you see instead?

image

Additional information

Workaround for astro compiler:

import { transform } from "./node_modules/@astrojs/compiler/node/index.js";
@paperdave paperdave added the bug Something isn't working label Mar 9, 2023
@Electroid Electroid added the npm Something that relates to the npm-compatible client label Mar 9, 2023
@Jarred-Sumner
Copy link
Collaborator

ah yeah, we should prioritize "browser" last

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working npm Something that relates to the npm-compatible client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants