Skip to content

[Feature Request]: side effects free dynamic import not removed. #3918

Description

@IWANABETHATGUY
          It seems that the following scenario is not supported:
// entry.ts
async function test() {
  const a = await import('./hello')
  const b = await import('./hello')

  console.log(a === b)
}

test()

// hello.ts

rolldown:

// entry.js
async function test() {
	const a = await import("./hello-hoTXCQ30.js");
	const b = await import("./hello-hoTXCQ30.js");
	console.log(a === b);
}
test();

// hello-hoTXCQ30.js

rollup:

async function test() {
  const a = await Promise.resolve().then(function () { return hello; });

  const b = await Promise.resolve().then(function () { return hello; });

  console.log(a === b);
}

test();

var hello = /*#__PURE__*/Object.freeze({
  __proto__: null
});

Originally posted by @shulaoda in #3911 (review)

Metadata

Metadata

Assignees

No one assigned

    Fields

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions