System Info
rspack core/cli - 1.7.8
pnpm 7.33.6
Details
I've update my rspack core/cli from 1.5.8 to 1.7.8 and faced bug - rspack start generating incorrect JS in DEV mode (not for all, but for some projects in pnpm monorepo).
Generated code looks like this (i've truncated some organization info):
var __webpack_modules__ = ...
...
},
"../../../../../../.s(() => { // (вот тут затирается код)
var __webpack_modules__ = ({
"../../../../../../.schoolbook-frontend-monorepo-tmp/pnpm-virtual-store/..."(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("{__webpack_require__.r(__webpack_exports__);\n// extracted by css-extract-rspack-plugin\n\n if(true) {\n (function() {\n
If you look closely, you can see webpack_modules twice.
After a couple of attempts I got the impression that the problem was in multiple writing to "filesystem", because each time code looks like overwriting 2 bundles in JS file.
Problem was faced only in JS bundles.
JS bundles on disk was correct, but when i was trying to get it from server it was incorrect.
Some WA that we found - disable https://rsbuild.rs/config/dev/write-to-disk helps.
I have researched and found breaking version interval: "1.6.0-beta.0" (valid) --> "1.6.0-beta.1" (breaked) in rspack/core.
After analyzing diff i found problem commit:
I've tried to remove this diff with manualy patching code and it works.
Patch looks like this (i patched deps by .pnpmfile.cjs, diff in package.json only for example):
diff --git a/dist/index.js b/dist/index.js
index 94846e8938af653393cfbee815402cd8d45f0682..540e63b5374b03fe3025d02e90751c193f191a3e 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -10856,7 +10856,7 @@ Help:
class RspackOptionsApply {
process(options, compiler) {
if (!options.output.path) throw Error("options.output.path should have a value after `applyRspackOptionsDefaults`");
- if (compiler.outputPath = options.output.path, compiler.name = options.name, compiler.outputFileSystem = external_node_fs_default(), options.externals) {
+ if (compiler.outputPath = options.output.path, compiler.name = options.name, compiler.outputFileSystem = require('graceful-fs'), options.externals) {
if (!options.externalsType) throw Error("options.externalsType should have a value after `applyRspackOptionsDefaults`");
new ExternalsPlugin(options.externalsType, options.externals, !1).apply(compiler);
}
diff --git a/package.json b/package.json
index cc361f08b517a5d22d35f62fc93b26acaa797122..98bd766f7f265861b1b6b3a1eb4b7cc1a3313449 100644
--- a/package.json
+++ b/package.json
@@ -55,6 +55,7 @@
"webpack-sources": "3.3.3"
},
"dependencies": {
+ "graceful-fs": "4.2.11",
"@module-federation/runtime-tools": "0.21.1",
"@rspack/lite-tapable": "1.0.1",
"@rspack/binding": "1.6.0-beta.1"
Reproduce link
No response
Reproduce Steps
I don't know
System Info
rspack core/cli - 1.7.8
pnpm 7.33.6
Details
I've update my rspack core/cli from 1.5.8 to 1.7.8 and faced bug - rspack start generating incorrect JS in DEV mode (not for all, but for some projects in pnpm monorepo).
Generated code looks like this (i've truncated some organization info):
If you look closely, you can see webpack_modules twice.
After a couple of attempts I got the impression that the problem was in multiple writing to "filesystem", because each time code looks like overwriting 2 bundles in JS file.
Problem was faced only in JS bundles.
JS bundles on disk was correct, but when i was trying to get it from server it was incorrect.
Some WA that we found - disable https://rsbuild.rs/config/dev/write-to-disk helps.
I have researched and found breaking version interval: "1.6.0-beta.0" (valid) --> "1.6.0-beta.1" (breaked) in rspack/core.
After analyzing diff i found problem commit:
I've tried to remove this diff with manualy patching code and it works.
Patch looks like this (i patched deps by .pnpmfile.cjs, diff in package.json only for example):
Reproduce link
No response
Reproduce Steps
I don't know