A GitHub template for creating a Rspack minimal reproducible example.
- Clone the repo
- Install the dependencies (
yarn install
) - Run
yarn run dev:rspack
- After the build finishes, open the project in your browser. You should see the following error in the browser console:
Uncaught ReferenceError: someFunction is not defined at ./src/index.ts (index.ts:3:1) at __webpack_require__ (index.ts:3:1) at rspack_unique_id:1:1 at rspack_unique_id:1:1
- In ./src/index.ts, change this code:
to this:
import { someFunction } from "./SomeFunction"; import("./Chunk") .then(someFunction("chunk"))
Now you should see the correct log in the console.import { someFunction } from "./SomeFunction"; import("./Chunk") .then((module) => someFunction("chunk")(module))
Note: With Rspack versions below 1.5.6, this issue does not occur.
- An expression like
.then((module) => someFunction("chunk")(module))
throws a ReferenceError.
- The expression
.then((module) => someFunction("chunk")(module))
should work correctly without throwing a ReferenceError.