Giter Site home page Giter Site logo

Comments (2)

semaurer avatar semaurer commented on May 17, 2024 1

Thanks for your response and help!

Looks like the culprit was actually just the wordpress site not being live. So when I refreshed on
example.com/~wpuser/examplepage. It would break just due to the url not matching, because my react router replacement was assuming that there would be no /~wpuser in the url. Once live without the ~wpuser it works fine when refreshing on /example page.

Thank you!

from create-react-wptheme.

devloco avatar devloco commented on May 17, 2024

Hi Stephen,

TL;DR: there was a bug in the "npm run build" command a couple of weeks ago. Check out the Updating instructions in the README and do that first. Then try modifying the user.prod.json file per the Build Configuration instructions. Hopefully npm run build will just work correctly for you then.

Here was the issue ticket for that bug, if you're interested: user.prod.json homepage property not used on wpbuild

If that doesn't just work for you, then you're going to have to read The Long Answer ;)

First off, there is no "wp-dev server" serving your pages. That's the whole point of this project, it is your WordPress server serving your theme. There is a little web-socket server running, but all it does it tell your browser that you made changes and then your browser refreshes when that happens.

So the fact that it works in your dev environment leads me to hope that you're just using the old version with the build bug. Sorry about that!

If updating and double-checking your user.prod.json file doesn't work, then I'm going to be a little stuck trying to help... I'm not much of a React-Router expert. But you might look at this tutorial, the author does use React Router in his theme: How To Build A Skin For Your Web App With React And WordPress

Finally, there might be some kind of hack you can come up with using either Webpack's "%PUBLIC_URL%" feature (see references to that in the index.php file in your public folder) or getting your theme's URL using PHP, like I do here in this file: post_installer.php. I do think that using either method is indeed a hack, so be careful.

Let me know how it goes!

Thanks,

-joe

from create-react-wptheme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.