Closed
Description
This is folder's structure of my project.
project_frontend /
app/
package.json
project_backend/
api/
static/
index.html
So I launch npm run build
from project_frontend and I need to put build files into project_backend. Also I don't need to put into there files like "manifest.json", "asset-manifest.json".
Thanks.
Metadata
Metadata
Assignees
Labels
No labels
Activity
gaearon commentedon Jan 17, 2018
In your
package.json
you have:You can add another script called
postbuild
that does something after the build and will be called by npm/Yarn automatically.You could also run a custom script that does more.
Hope this helps!
thecalvinchan commentedon Jun 24, 2018
i don't think this is a valid solution because it assumes that the
build
directory is not being used by some other service. For example, i have backend code that compiles to abuild
directory, then this would also affect those files as well.True, a proper separation of concerns here would be the right move, making each their own codebase and repository, but would definitely like to see an option to set a build-dir option in react scripts
sairathb commentedon Jul 18, 2018
I found a way to get it to work. I was facing the same issue of moving my react build to ../public folder, since I am writing a test application and using node back end. You can run the
npm run eject
to get all the webpack files. then change the ./config/path.js file to updateappBuild: resolveApp('../public'),
Hope that helps
pavelhamrik commentedon Dec 4, 2018
@sairathb I wouldn't eject just for this, losing the ability to update.
nsoufian commentedon Dec 28, 2018
I absolutely agree with you @pasichnyk , I have the same issues I always ejecting my react.js projects for changing the build path or adding one or two plugins to my webpack and I lose the ability to update my scripts.
I hope that react team @gaearon takes into consideration this problem and try to find
a good solution for us" React.js users" to add configurations to env or webpack without ejecting and losing the ability of updates, it's can help us a lot, for example creating new open source project that depends on create-react-app.
tanks you react team for hooks :D