Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][DevServer]: TypeError: Cannot read properties of undefined (reading 'get') when making network request to compiled asset #7618

Closed
mxmason opened this issue Aug 20, 2024 · 2 comments · Fixed by #7676
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@mxmason
Copy link

mxmason commented Aug 20, 2024

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

  1. run pnpm i
  2. run pnpm run dev:rspack
  3. verify that the server has not crashed yet
  4. navigate to http://localhost:8080
  5. verify that the index.html file is returned, but there's no "hello world" from the main bundle
  6. verify that the dev server has crashed
  7. 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.

@mxmason mxmason added bug Something isn't working pending triage The issue/PR is currently untouched. labels Aug 20, 2024
@h-a-n-a
Copy link
Contributor

h-a-n-a commented Aug 23, 2024

Closed as fixed by upstream: webpack/webpack-dev-middleware#1927

@h-a-n-a h-a-n-a closed this as completed Aug 23, 2024
@mxmason
Copy link
Author

mxmason commented Aug 23, 2024

Thanks, @h-a-n-a. It looks like [email protected] has this fix, but the latest release of rspack doesn't use 7.4.2. Can you say when rspack will upgrade its dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants