Compare commits

...

7 Commits

Author SHA1 Message Date
dave caruso
a891163add Merge branch 'main' into dave/bundler-require-ref 2024-09-23 15:21:33 -07:00
Jarred Sumner
6dd211ec95 Merge branch 'main' into dave/bundler-require-ref 2024-08-01 14:31:37 -07:00
dave caruso
0acbfd88b3 Merge branch 'main' into dave/bundler-require-ref 2024-07-31 19:33:27 -07:00
dave caruso
59ca9813da ok 2024-07-24 16:33:36 -07:00
dave caruso
ff09170214 Merge remote-tracking branch 'origin/main' into dave/bundler-require-ref 2024-07-24 15:40:37 -07:00
dave caruso
f139a6afd3 document what this is 2024-07-23 22:01:56 -07:00
dave caruso
69d07f835a fixes 12615 2024-07-23 21:56:54 -07:00
2 changed files with 14 additions and 2 deletions

View File

@@ -5451,11 +5451,10 @@ pub const LinkerContext = struct {
continue;
} else {
// We should use "__require" instead of "require" if we're not
// generating a CommonJS output file, since it won't exist otherwise.
// Disabled for target bun because `import.meta.require` will be inlined.
if (shouldCallRuntimeRequire(output_format) and !this.resolver.opts.target.isBun()) {
if (kind != .dynamic or shouldCallRuntimeRequire(output_format) and !this.resolver.opts.target.isBun()) {
record.calls_runtime_require = true;
runtime_require_uses += 1;
}

View File

@@ -857,6 +857,19 @@ describe("bundler", () => {
stdout: `0.6.0`,
},
});
itBundled("edgecase/ExternalDynamicImportDoesNotIncludeRuntime", {
files: {
"/entry.js": /* js */ `
import('something');
`,
},
external: ["something"],
onAfterBundle(api) {
api.expectFile("/out.js").not.toContain("__require");
// throw Error('Dynamic require of "' + x + '" is not supported')
api.expectFile("/out.js").not.toContain("Dynamic require");
},
});
itBundled("edgecase/OverwriteInputWithOutdir", {
todo: true,
files: {