Description
System Info
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M2
Memory: 70.70 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
pnpm: 8.15.6 - ~/.nvm/versions/node/v20.11.1/bin/pnpm
bun: 1.1.12 - ~/.bun/bin/bun
npmPackages:
@rspack/cli: 1.0.0-beta.5 => 1.0.0-beta.5
@rspack/core: 1.0.0-beta.5 => 1.0.0-beta.5
Details
After starting the dev server, it crashes as soon as the browser requests one of its compiled assets.
The crash produces the following error (path truncated for brevity):
[...]/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-dev-middleware/dist/utils/getFilenameFromUrl.js:120
const assetInfo = assetsInfo.get(pathname.slice(publicPathObject.pathname.length));
^
TypeError: Cannot read properties of undefined (reading 'get')
at getFilenameFromUrl ([...]/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-dev-middleware/dist/utils/getFilenameFromUrl.js:120:38)
at processRequest ([...]/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-dev-middleware/dist/middleware.js:393:24)
at ready ([...]/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-dev-middleware/dist/utils/ready.js:16:5)
at middleware ([...]/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-dev-middleware/dist/middleware.js:666:5)
at Layer.handle [as handle_request] ([...]/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix ([...]/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:328:13)
at [...]/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:286:9
at Function.process_params ([...]/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:346:12)
at next ([...]/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/index.js:280:10)
at compression ([...]/node_modules/.pnpm/[email protected]/node_modules/compression/index.js:220:5)
Reproduce link
https://github.com/mxmason/rspack-repro-dev-crash
Reproduce Steps
- run
pnpm i
- run
pnpm run dev:rspack
- verify that the server has not crashed yet
- navigate to http://localhost:8080
- verify that the index.html file is returned, but there's no "hello world" from the
main
bundle - verify that the dev server has crashed
- run
pnpm run dev:webpack
and verify that "hello world" does render
Note
DevServer crashes as soon as the browser requests main.js
. If you comment out the plugins
array in config.mjs
, the server will only crash if you go to http://localhost:8080/main.js
.