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

fix(core): fix a bug where a package's code could not load its own package #779

Merged
merged 8 commits into from
Jan 14, 2025

Conversation

nabetti1720
Copy link
Contributor

Description of changes

For example, when react-dom/server.edge was called, this issue occurred because react-dom was required again inside the package.

// reproduction.js
import * as dom from "react-dom/server.edge";
console.log(dom);
% llrt reproduction.js 
Error: IO Error: No such file or directory (os error 2)
  at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/react-dom/cjs/react-dom-server.edge.development.js:7330:18)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/react-dom/cjs/react-dom-server.edge.development.js:8975:3)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/react-dom/server.edge.js:9:7)

% bun reproduction.js
Module {
  default: {
    version: "19.0.0",
    renderToReadableStream: [Function],
    renderToString: [Function],
    renderToStaticMarkup: [Function],
  },
  renderToReadableStream: [Function],
  renderToStaticMarkup: [Function],
  renderToString: [Function],
  version: "19.0.0",
}

This PR fixes this by storing the correct path when referencing self, to avoid IO errors.

Checklist

  • Created unit tests in tests/unit and/or in Rust for my feature if needed
  • Ran make fix to format JS and apply Clippy auto fixes
  • Made sure my code didn't add any additional warnings: make check
  • Added relevant type info in types/ directory
  • Updated documentation if needed (API.md/README.md/Other)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@richarddavison
Copy link
Contributor

richarddavison commented Jan 11, 2025

Thanks! Looks like there is some Windows issue with path / replacement?

@nabetti1720
Copy link
Contributor Author

Thanks! Looks like there is some Windows issue with path / replacement?

It seems that's the case, but I haven't yet found the cause, so I'll need to investigate further...

@richarddavison richarddavison merged commit ea4d05b into awslabs:main Jan 14, 2025
11 checks passed
@nabetti1720 nabetti1720 deleted the fix/require branch January 14, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants