Skip to content

[Bug]: strictExecutionOrder: true makes re-exported values undefined #4920

@hi-ogawa

Description

@hi-ogawa

Reproduction link or steps

reproduction: https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/rolldown-vite-251?file=rolldown.config.js

With strictExecutionOrder: true and following source files:

  • entry.js
import dep from "./dep.js"
export { dep }
  • dep.js
export default "dep-ok"

build output becomes:

//#region rolldown:runtime
var __getOwnPropNames = Object.getOwnPropertyNames;
var __esm = (fn, res) => function() {
	return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};

//#endregion
//#region src/dep.js
var dep_default;
var init_dep = __esm({ "src/dep.js"() {  // 👈👈 not executed
	dep_default = "dep-ok";
} });

//#endregion
//#region src/entry.js
var init_entry = __esm({ "src/entry.js"() {} });

//#endregion
init_entry();
export { dep_default as dep };

This will cause dep to be undefined when importing the build output.

What is expected?

Running the source file directly on Node:

$ node -e 'import("./src/entry.js").then(console.log)'
[Module: null prototype] { dep: 'dep-ok' }

What is actually happening?

Running the build output:

$ node -e 'import("./dist/entry.js").then(console.log)'
[Module: null prototype] { dep: undefined }

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown: 1.0.0-beta.15 => 1.0.0-beta.15

Any additional comments?

Downstream issue vitejs/rolldown-vite#251

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions