Closed NathZ1 closed 3 weeks ago
Sounds like a duplicate of https://github.com/webpack/enhanced-resolve/issues/395
Hi @alexander-akait, thank you for your reply. I have reviewed the issue you linked, but I don't think it is the same issue. I am not using enhanced-resolve at all.
I have now created a small public repo where you can demo the issue -
https://github.com/NathZ1/webpack-dev-server-error-repo
Simply npm install, npm start, then rename the file 'src/FileToRename.tsx' and you should see the same webpack-dev-server crash as I am experiencing.
Don't use bail: true
https://webpack.js.org/configuration/other-options/#bail, we have a tip about it. Bail stop any other compilations when the first error happend.
Avoid using bail option in watch mode, as it will force webpack to exit as soon as possible when an error is found.
Ahh of course!! Apologies for taking up your time. Cheers
Bug report
I renamed a file in my project called Table.tsx to Table2.tsx file webpack-dev-server was running. This consistancy causes the crash to occur. Happens with rename/move/delete of any file within project src.
error from IDE console:
Actual Behavior
Webpack-dev-server crashes when a file is renamed/deleted/moved etc. I'm not sure if this is a regression, but in a previous project it would throw an error in the console and the client but the server wouldn't crash.
Expected Behavior
It should throw an error saying the file is missing, but the server should continue to function without having to kill and restart.
How Do We Reproduce?
tsconfig.json:
webpack.config.ts:
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationSystem: OS: Windows 10 10.0.19045 CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U Memory: 2.40 GB / 15.59 GB Binaries: Node: 20.11.1 - C:\Program Files\nodejs\node.EXE npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Chromium (127.0.2651.74) Internet Explorer: 11.0.19041.4355 Packages: copy-webpack-plugin: ^12.0.2 => 12.0.2 css-loader: ^7.1.1 => 7.1.2 css-minimizer-webpack-plugin: ^6.0.0 => 6.0.0 eslint-webpack-plugin: ^4.0.1 => 4.2.0 fork-ts-checker-webpack-plugin: ^9.0.0 => 9.0.2 html-webpack-plugin: ^5.5.1 => 5.6.0 postcss-loader: ^8.1.0 => 8.1.1 source-map-loader: ^5.0.0 => 5.0.0 style-loader: ^4.0.0 => 4.0.0 ts-loader: ^9.4.2 => 9.5.1 webpack: ^5.81.0 => 5.93.0 webpack-bundle-analyzer: ^4.9.0 => 4.10.2 webpack-cli: ^5.0.2 => 5.1.4 webpack-dev-server: ^5.0.4 => 5.0.4 webpack-manifest-plugin: ^5.0.0 => 5.0.0 workbox-webpack-plugin: ^7.0.0 => 7.1.0