Closed this-is-rafa closed 4 years ago
Hey @this-is-rafa, Sorry about that. I'll get it fixed up this weekend.
Thanks for letting me know!
Just thinking... if you need a work-around for now, it might work to change the homepage value in package.json before running build, and then setting it back again if you need to go back into Dev Mode.
Annoying for sure, but if you need it sooner than I can fix it... that might work.
No worries, I knew about the workaround. Very much appreciate the project.
I spent a few hours digging through the code yesterday looking to see if I could see if I could find where it was happening, but I really don't understand the principles behind CRA. It definitely looks at the user.prod file to get the build directory, but it doesn't look like it uses the hompage attribute anywhere.
Wow, this is really difficult.
I think I see why create-react-app
doesn't use user modifiable config files.
I need a couple of more days to iron this out... sorry about that.
Thanks
@this-is-rafa,
This should be all fixed up now.
Just FYI: One of the new features Facebook added to v3.4.0 is a way to do this via ENV vars. For example, I changed the build script line in my test theme's package.json
file:
"build": "SET PUBLIC_URL=/wordpress8/wp-content/themes/bar2 && wptheme-scripts build",
Since that's built into create-react-app
now, I decided it should take precedence. So if you have "homepage" in your user.prod.json
set and you have ENV.PUBLIC_URL
the ENV will win.
Thanks again for reporting the bug!
Works great. Thanks again.
For others reading, my setup didn't require me to use the keyword 'SET'.
Running
npm run build
builds the theme but ignores the user.prod.json homepage directory.After the script finishes, the output confirms it:
This is running 3.4.0. I'm pretty sure it worked in a previous version.