Repository: next.js
Issue: Next.js Web Server should serve webpack assets like WebPack Dev Server
Labels: bug,Webpack

### Link to the code that reproduces this issue

[https://codesandbox.io/p/devbox/pedantic-cherry-k8f3cg?workspaceId=92e5b30e-1491-4cd6-9774-f032926ce2c4](https://codesandbox.io/p/devbox/pedantic-cherry-k8f3cg?workspaceId=92e5b30e-1491-4cd6-9774-f032926ce2c4&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cly02lztv0006356j1vhg0ulj%2522%252C%2522sizes%2522%253A%255B85.61085972850678%252C14.389140271493218%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cly02lztu0002356jk80xc1v6%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cly02lztu0004356j6b3x19go%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cly02lztu0005356jwn3gsoya%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B58.23891334185243%252C41.76108665814757%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cly02lztu0002356jk80xc1v6%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cly02lztu0001356jw9m9uv8o%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522cly02nlx8001u356jxxg8lit3%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A4%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A4%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fyarn.lock%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522cly02lztu0002356jk80xc1v6%2522%252C%2522activeTabId%2522%253A%2522cly02nlx8001u356jxxg8lit3%2522%257D%252C%2522cly02lztu0005356jwn3gsoya%2522%253A%257B%2522id%2522%253A%2522cly02lztu0005356jwn3gsoya%2522%252C%2522activeTabId%2522%253A%2522cly03044c0050356kb777y9jl%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522cly03044c0050356kb777y9jl%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252Fmyasset%252Ftest.txt%2522%257D%255D%257D%252C%2522cly02lztu0004356j6b3x19go%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cly02lztu0003356jsvkihi8l%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%255D%252C%2522id%2522%253A%2522cly02lztu0004356j6b3x19go%2522%252C%2522activeTabId%2522%253A%2522cly02lztu0003356jsvkihi8l%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)

### To Reproduce

1. Start the application in development mode. 
2. Open the `myasset/test.txt` URL
3. Notice that the asset is not served but a error 404 is delivered. 

### Current vs. Expected behavior

**Expected:** When assets are emitted in webpack plugins, they are normally served by the webpack dev server under the provided asset name path. 

**Actual Behavior:** The custom webserver of next.js does not follow this behavior breaking various plugins registering dynamic assets for the application. Next.js will render the typical error 404 page for these URIs. 



### Provide environment information

```bash
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.0.0-canary.48 // Latest available version is detected (15.0.0-canary.48).
  eslint-config-next: N/A
  react: 19.0.0-rc-6f23540c7d-20240528
  react-dom: 19.0.0-rc-6f23540c7d-20240528
  typescript: 5.3.3
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

Webpack

### Which stage(s) are affected? (Select all that apply)

next dev (local)

### Additional context

If you register the exact same WebPack plugin in a standalone webpack project and use `npx webpack serve` the file will be served. 


Related issues: 
* https://github.com/vercel/next.js/discussions/32836
* https://github.com/vercel/next.js/issues/45478
* https://github.com/vercel/next.js/issues/29362

I assume the problem somewhere in https://github.com/vercel/next.js/tree/canary/packages/next/src/server but I couldn't find yet a good spot where such kind of assets would be served. 

Also when serving the assets the rules defined in `compiler.options.module.rules` might need to be respected. 
https://webpack.js.org/guides/asset-management/