mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Fix ESM <> CJS dual-package hazard determinism bug (#22231)
### What does this PR do? Originally, we attempted to avoid the "dual package hazard" right before we enqueue a parse task, but that code gets called in a non-deterministic order. This meant that some of your modules would use the right variant and some of them would not. We have to instead do that in a separate pass, after all the files are parsed. The thing to watch out for with this PR is how it impacts the dev server. ### How did you verify your code works? Unskipped tests. Plus manual. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -793,7 +793,7 @@ describe("bundler", () => {
|
||||
stdout: "main",
|
||||
},
|
||||
});
|
||||
itBundled.skip("packagejson/DualPackageHazardImportAndRequireSameFile", {
|
||||
itBundled("packagejson/DualPackageHazardImportAndRequireSameFile", {
|
||||
files: {
|
||||
"/Users/user/project/src/entry.js": /* js */ `
|
||||
import value from 'demo-pkg'
|
||||
@@ -812,7 +812,7 @@ describe("bundler", () => {
|
||||
stdout: "main main",
|
||||
},
|
||||
});
|
||||
itBundled.skip("packagejson/DualPackageHazardImportAndRequireSeparateFiles", {
|
||||
itBundled("packagejson/DualPackageHazardImportAndRequireSeparateFiles", {
|
||||
files: {
|
||||
"/Users/user/project/src/entry.js": /* js */ `
|
||||
import './test-main'
|
||||
@@ -861,7 +861,7 @@ describe("bundler", () => {
|
||||
stdout: "module\nmodule",
|
||||
},
|
||||
});
|
||||
itBundled.skip("packagejson/DualPackageHazardImportAndRequireImplicitMain", {
|
||||
itBundled("packagejson/DualPackageHazardImportAndRequireImplicitMain", {
|
||||
files: {
|
||||
"/Users/user/project/src/entry.js": /* js */ `
|
||||
import './test-index'
|
||||
|
||||
Reference in New Issue
Block a user