-
- Notifications
You must be signed in to change notification settings - Fork 383
Description
Bug report
Yesterday, streamich/memfs
version 4.43.0
was released (dependency of webpack-dev-middleware
), which breaks serving files from memory (only files in the devServer.static
folder are served).
I did not dig deeper into the bug, it is possible that this is caused by an incorrect configuration on my end, but it happened to me on a fresh webpack project with the latest packages.
Actual Behavior
When launching webpack serve --mode development
with the webpack.config.js
below (on webpack@5.101.3
, webpack-dev-server@5.2.2
and memfs@4.43.0
), a white page with Cannot GET /
appears and any files generated by webpack which aren't already present in the directory specified by devServer.static
are not available.
webpack.config.js
:
module.exports = (env, argv) => { const isDevelopment = argv.mode === 'development'; return { entry: path.resolve(__dirname, 'src', 'index.ts'), output: { path: path.resolve(__dirname, 'dist'), filename: 'output.js', clean: !isDevelopment }, devtool: isDevelopment ? 'source-map' : false, module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ }, { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] } ] }, resolve: { extensions: ['.ts', '.js'], alias: { '@': path.resolve(__dirname, 'src') } }, optimization: { minimizer: [ `...`, new CssMinimizerPlugin() ] }, plugins: [ new MiniCssExtractPlugin(), new HtmlWebpackPlugin({ template: path.resolve(__dirname, 'src', 'html', 'index.html'), scriptLoading: 'defer' }) ], devServer: { static: { directory: path.join(__dirname, 'dist') }, compress: true, port: 9000, open: true, hot: true } } }
Expected Behavior
Files generated during the build stage of webpack serve
should be available on the server.
How Do We Reproduce?
- Install the following depencenies (which will install
memfs@4.43.0
):{ "@types/webpack-env": "^1.18.8", "css-loader": "^7.1.2", "css-minimizer-webpack-plugin": "^7.0.2", "html-webpack-plugin": "^5.6.3", "mini-css-extract-plugin": "^2.9.3", "style-loader": "^4.0.0", "ts-loader": "^9.5.1", "typescript": "^5.6.3", "webpack": "^5.96.1", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.2.1" }
- Copy the
webpack.config.js
file from above - Create files
index.ts
andhtml/index.html
insrc/
- Run
webpack serve --mode development
Please paste the results of npx webpack-cli info
here, and mention other relevant information
System: OS: Windows 11 10.0.26100 CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12450H Memory: 4.94 GB / 15.70 GB Binaries: Node: 22.14.0 - C:\Program Files\nodejs\node.EXE npm: 10.2.5 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Chromium (140.0.3485.66) Packages: css-loader: ^7.1.2 => 7.1.2 css-minimizer-webpack-plugin: ^7.0.2 => 7.0.2 html-webpack-plugin: ^5.6.3 => 5.6.4 ts-loader: ^9.5.1 => 9.5.4 webpack: ^5.96.1 => 5.101.3 webpack-cli: ^5.1.4 => 5.1.4 webpack-dev-middleware: ^7.4.2 => 7.4.3 webpack-dev-server: ^5.2.1 => 5.2.2
Let me know if you need the output of npm ls --all
aswell.