Skip to content

Treeshaking shaked variable that is used #4336

@JSerFeng

Description

@JSerFeng

Repro

webpack-test/configCases/split-chunks/async-entries

input:

import { parentPort } from "worker_threads";
import value from "./module";

parentPort.on("message", async data => {
	const { upper } = await import("./chunk");
	parentPort.postMessage(`data: ${upper(data)}, value: ${value}, thanks`);
});

output:

__webpack_require__.r(__webpack_exports__);
/* harmony import */var worker_threads__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* worker_threads */"409");
/* harmony import */var worker_threads__WEBPACK_IMPORTED_MODULE_0__default = /*#__PURE__*/__webpack_require__.n(worker_threads__WEBPACK_IMPORTED_MODULE_0_);


/* "worker_threads" unused */null("message", async (data)=>{
    const { upper } = await __webpack_require__.el(/* ./chunk */"52").then(__webpack_require__.bind(__webpack_require__, /* ./chunk */"52"));
    /* "worker_threads" unused */null(`data: ${upper(data)}, value: ${/* "./module" unused */null}, thanks`);
});
},

Metadata

Metadata

Labels

teamThe issue/pr is created by the member of Rspack.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions