rsdoctor: [Bug]: [webpack-dev-middleware] RangeError: Invalid string length

Version

N/A

Details

Entrypoint main 116 MiB = main-8d27d6eb9b39386ef1df.js Entrypoint unsupportedBrowser 887 KiB = unsupportedBrowser-b4d2fea7fce3de54a441.js Entrypoint reactdevtools 645 KiB = reactdevtools-b671b3ece8b25cd3fd9b.js Rspack 0.5.2 compiled successfully in 27.12 s (2faf356ab27d33a22682) <e> [webpack-dev-middleware] RangeError: Invalid string length <e> at PassThrough.<anonymous> (/Users/pushkargupta/source/teams-modular-packages/node_modules/@rsdoctor/utils/dist/cjs/build/json.js:33:16) <e> at PassThrough.emit (node:events:513:28) <e> at addChunk (node:internal/streams/readable:315:12)

Running into the above error with rsdoctor and serving an application.

Reproduce link

N/A

Reproduce Steps

yarn rspack serve with rsdoctor

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

@easy1090 Thank you for looking into this! I can confirm that with the latest version RsDoctor now works as expected for our application 👍 . I did not need do set noAssetsAndModuleSource, the plain new RsdoctorWebpackPlugin() works as well.

@pushkargupta9807 This issue has fixed by #419

I will open another one issue #426 for the optimize of the large loader data .

@pushkargupta9807 I’ll try to fixed this problem this week.

@pushkargupta9807
If you turn on the loader option, an invalid string length error will occur, right?

@pushkargupta9807 @zackarychapple

After detailed investigation, it was found that there is a problem with the noAssetsAndModuleSource configuration in the rspack mode (I made the problem more complicated, which led to a delay in solving this problem for a relatively long time). Please try the rsdoctor @0.3.2 version, and at the same time, add the following reportCodeType configuration:

new RsdoctorWebpackPlugin({
      features: ['bundle', '....'],// some features 
      reportCodeType: { noAssetsAndModuleSource: true }
    }

I have tried the above scheme for a project that also has this problem, and it is effective. If you have any questions, please continue to contact me.

In addition, if it is an MF project, there may be a problem of the overly large size of stats.json, because the identifier of the container entry module of the issuerPath may be very long, and the container entry module may appear very many times. The overly large stats.json will lead to too slow analysis of rsdoctor. It can be considered to turn off the ability to parse the bundle to some modules, and the configuration is as follows:

new RsdoctorWebpackPlugin({
      features: ['bundle', '....'],// some features 
      reportCodeType: { noAssetsAndModuleSource: true },
      supports: {
        parseBundle: false,
      }
    }

I’m running into this too and with just a portion of a a codebase. The build without rsdoctor completes in about 20s, with rsdoctor I get the error below. I took a peek at the .rsdoctor folder and its 3.3MB.

[rspack-cli] RangeError: Invalid string length
    at PassThrough.<anonymous> (/Volumes/CaseSensitive/myrepo/node_modules/@rsdoctor/utils/dist/cjs/build/json.js:33:16)
    at PassThrough.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at node:internal/streams/transform:178:12
    at PassThrough._transform (node:internal/streams/passthrough:46:3)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)

I’ll find a repo has this similar problem and fix this problem by reproduction the chunk graph data structure.