Changing the target build path to lib is throwing an exception. Below is the config-overrides.js:
const path = require('path');
config.output = {
path: path.resolve(__dirname, 'lib'),
libraryTarget: 'umd',
};
package.json
"build": "react-app-rewired build",
lib folder created but is throwing an exception, and is looking for main.js at build folder, rather than looking at lib folder:
no such file or directory buildmain.js'
the same, Is there any solution?
Try using the paths config as documented in the readme.
module.exports = {
webpack: function(config, env) {
// your normal config-overrides.js overrides
return config;
},
// The paths config to use when compiling your react app
// for development or production.
paths: function(paths, env) {
// ...add your paths config
paths.appBuild = path.resolve(__dirname, 'lib');
return paths;
}
}
See create-react-app config/paths for the list of path variables - the one you would want to change is the paths.appBuild path.
If that doesn't work, try the alternative method documented here.
@dawnmist thank you so much! lifesaver!
Most helpful comment
Try using the paths config as documented in the readme.
See create-react-app config/paths for the list of path variables - the one you would want to change is the
paths.appBuildpath.If that doesn't work, try the alternative method documented here.