Skip to content

[Feature Request]: inline dynamic imports that imports statically imported modules #4905

@sapphi-red

Description

@sapphi-red

What problem does this feature solve?

When an module is imported statically, dynamic imports to that module can be inlined.
For example of https://stackblitz.com/edit/rolldown-rolldown-starter-stackblitz-5krehyfj?file=src%2Fentry.js,src%2Ffoo.js , the output can be:

const foo = "foo";

var foo$1 = /*#__PURE__*/Object.freeze({
  __proto__: null,
  foo: foo,
  [Symbol.toStringTag]: 'Module'
});

console.log(foo);

Promise.resolve().then(function () { return foo$1; }).then(mod => console.log(mod.foo));

This is what rollup does (repl).

refs #4904

What does the proposed API look like?

Not an API change

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions