'In windows webpack-dev-server with writeToDisk not working
Using webpack-dev-server through the nodejs API and it is fail to run in windows if we enable writeToDisk option and same has been working fine in Mac.
Tested in different node versions(12, 14, 16), but same issue in windows
Versions:
"webpack": "^5.38.1",
"webpack-dev-server": "^4.8.1",
"webpack-cli": "^4.9.1"
Webpack dev server config in nodeJS
const clientWebpack = customizeWebpack[0];
const clientCompiler = webpack(clientWebpack);
const portChoose = await choosePort(3000);
const devMiddlewareConfig = {
port: portChoose,
host: '0.0.0.0',
devMiddleware: {
publicPath: '/',
writeToDisk: true,
stats: {
colors: true,
assets: true
},
},
historyApiFallback: true
};
const server = new WebpackDevServer(devMiddlewareConfig, clientCompiler);
await server.start();
Error Trace:
build [=================== ] 93% [webpack-dev-middleware] Child "client": Unable to write "C:\test\build____\data:text" directory to disk: Error: ENOENT: no such file or directory, mkdir 'C:\test\build____\data:text' Build completed in 10.516s
[webpack-dev-middleware] [Error: ENOENT: no such file or directory, mkdir 'C:\test\build____\data:text'] { errno: -4058, code: 'ENOENT', syscall: 'mkdir', path: 'C:\test\build\\\\\data:text' }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
