Compare commits

...

1 Commits

Author SHA1 Message Date
Dylan Conway
6a31893ce5 only if assign target is none, tests for cjs/esm bundling 2023-06-05 23:12:18 -07:00
2 changed files with 50 additions and 1 deletions

View File

@@ -17620,7 +17620,7 @@ fn NewParser_(
if (comptime FeatureFlags.unwrap_commonjs_to_esm) {
if (!p.is_control_flow_dead and id.ref.eql(p.exports_ref)) {
if (!p.commonjs_named_exports_deoptimized) {
if (!p.commonjs_named_exports_deoptimized and identifier_opts.assign_target != .none) {
if (identifier_opts.is_delete_target) {
p.deoptimizeCommonJSNamedExports();
return null;

View File

@@ -68,4 +68,53 @@ describe("bundler", () => {
stdout: "pass",
},
});
itBundled("npm/LodashEsmImportEsmExport", {
files: {
"/entry.js": /* js */ `
import { isEqual, uniq } from "lodash-es"
console.log(isEqual({a: 1}, {a: 1}))
`,
},
install: ["lodash-es"],
run: {
stdout: "true",
},
});
itBundled("npm/LodashEsmImportCjsExport", {
files: {
"/entry.js": /* js */ `
import { isEqual, uniq } from "lodash"
console.log(isEqual({a: 1}, {a: 1}))
`,
},
install: ["lodash"],
run: {
stdout: "true",
},
});
itBundled("npm/LodashCjsImportCjsExport", {
files: {
"/entry.js": /* js */ `
const { isEqual, uniq } = require("lodash");
console.log(isEqual({a: 1}, {a: 1}))
`,
},
install: ["lodash"],
run: {
stdout: "true",
},
});
itBundled("npm/LodashCjsImportEsmExport", {
todo: true,
files: {
"/entry.js": /* js */ `
const { isEqual, uniq } = require("lodash-es");
console.log(isEqual({a: 1}, {a: 1}))
`,
},
install: ["lodash-es"],
run: {
stdout: "true",
},
});
});