Reputation: 1241
I'm trying to migrate an ejected create-react-app to Webpack 5 and running into this error:
Failed to compile.
The "path" argument must be of type string. Received undefined
error Command failed with exit code 1.
I think the error is coming from output.path
which by default from CRA is undefined in development, I have tried to set it to an empty string - or an absolute path and it would not resolve. I have been able to successfuly get Webpack 5 working on a non-cra app with leaving the path as undefined, so I'm thinking its related to the CRA config. Also I have followed this guide with no success https://webpack.js.org/migrate/5/
Code Sandbox: https://codesandbox.io/s/musing-buck-shu04
Appreciate any help!
Upvotes: 3
Views: 5215
Reputation: 531
I'm facing with same problem. This error is raised from webpack-manifest-plugin
. Webpack 5 is not supported at now, but maintainer are planning to add support.
So you can change several lines in default.config.js
output
section from:
output: {
// The build folder.
path: isEnvProduction ? paths.appBuild : undefined,
// blah blah blah
}
to:
output: {
// The build folder.
path: paths.appBuild,
// blah blah blah
}
Error The "path" argument must be of type string. Received undefined
disappears. But it still not working for me. I get endless loading in browser. I should to debug it more careful and update answer later.
So, I tried to remove webpack-manifest-plugin
from my configuration, but it still not working.
Upvotes: 5