How can I override the build directory?
See original GitHub issueI’m trying to override the build folder by changing webpackConfig.output.path
, here is my craco.config.js
file:
const path = require('path');
const overrideWebpackConfig = ({ webpackConfig }) => {
webpackConfig.output.path = path.resolve('my', 'custom', 'folder');
return webpackConfig;
};
module.exports = {
plugins: [
{
plugin: { overrideWebpackConfig }
}
]
};
When running craco build
, it works until the very end, when react-scripts tries to print out the gzipped size of all the files. I get the error:
ENOENT: no such file or directory, open '/path/to/project/MyProject/build/static/css/main.16e7b84a.chunk.css'
This is still looking at the build
folder, not my/custom/folder
. Digging into it, react-scripts has this file node_modules/react-scripts/config/paths.js
which is being used. Is there a way to modify this file using craco
?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How can I override the build directory? · Issue #104 - GitHub
I'm trying to override the build folder by changing webpackConfig.output.path, here is my craco.config.js file: const path = require('path') ...
Read more >Override build steps - doc - snapcraft.io
This can be done by utilising the override-build override. Its working directory is the part's base build directory in parts/<part name>/build/ .
Read more >Is there a way to override build and dist directories that ...
1 Answer 1 · 1) First I edited nbproject/project.properties file and added a variable for toplevel build dir. · 2) Then I made...
Read more >how to override the build folder per project via cmake
You can change the build directory in CMake profile (File | Settings | Build, Execution, Deployment | CMake) - https://www.jetbrains.com/help/ ...
Read more >Change the build output directory - Visual Studio (Windows)
Change the build output directory · For C#, select the Build tab. · For Visual Basic, select the Compile tab. · For C++...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Replying to an old thread here, but the following approach worked for me so maybe it will help someone searching for an answer in the future.
PS: Any unexpected issues I should be aware of with this approach?
@spartakb you should return
webpackConfig
in the end of the function. Then it works for me, thank you.