« first day (3079 days earlier)      last day (1861 days later) » 

1:36 PM
@TomJNowell so I finished my React Application, and it works great. My question now is, how can I deploy this React Application into my WordPress plugin?
I ran the build operation, but I'm not sure what to do with this output or how to get it to work with my plugin now.
There's some manifest files, service worker, precache, then in the JS directory there's a couple of chunk files and main runtime file?
 
1:59 PM
I also just tried to bring my "standalone script" into the source directory, but since it uses jQuery now it's saying jQuery isn't defined, and when I try $ it says that's not defined either. I already added jQuery with NPM, and imported it like import $ from 'jquery'; in the app.js right before my script.
How does that work if I bundle jQuery with my React App anyways? My WordPress site already has jQuery enqueued
 
@MichaelEcklund I don't follow? The output is JS, there's nothing unusual or special about the output that requires additional handling
just enqueue it
I'm sure you wouldn't have that question if you copy pasted some slider setup code into a JS file and enqueued it in your theme, how is this different?
and do you really need to use jQuery?
especially if you're using it for network requests, why not just use fetch?
 
That's what it looks like
 
not sure why you bothered to chunk it up
 
@TomJNowell I'm looking into ditching jQuery
What do you mean?
I just ran npm build or whatever
 
you made webpack break it up into chunks
 
2:07 PM
What do you do to build it?
 
but I guess the one without chunk is the one you want, I couldn't possibly tell from just a screenshot
@MichaelEcklund I run npm build
but what my npm build does won't be the same as yours
 
oh, why?
how can I simplify mine?
 
much like saying "I ran php build.php and it spat out some stuff"
 
I just want to make it easy to integrate React Apps into my WordPress plugins
 
it's not a very meaningful thing to say, I have no idea where you got your webpack config or how it's setup
 
2:09 PM
I'm trying to update my WordPress plugins to utilize React
 
so I'd go back to where you got your stuff from
and consult their docs
 
What do you mean?
 
I'd hope that it just outright tells you where the main file is
@MichaelEcklund are you telling me you wrote your webpack/babel config stuff from scratch?
 
no?
one sec
 
I'm pretty sure you didn't find it in a drawer somewhere on a mystery USB drive
there'll be docs
 
2:10 PM
@TomJNowell I used this npx create-react-app my-app
 
but also you only have 3 JS files you could enqueue
try all 3, only 1 would work
 
but in the meantime, read their docs
I've never used create-react-app
 
but what is the service worker and manifest stuff?
 
you'd have to look at their docs, I've never used that before
but I can tell you a service worker and a manifest are different things
 
2:11 PM
oh... How do you develop your apps then?
 
but I would hope they document it
 
I'm a newb, this is my first app
 
I have a much simpler webpack/babel setup that doesn't do a lot
well you went down a route I'm unfamiliar with
and a lot of these questions aren't React specific
 
damn, I thought You'd be able to help me
 
whatever you chose, it made a service worker for you, that's not a React thing
nor is a manifest
 
2:12 PM
oh, so I don't need that for my WP site?
 
when I first gave that thing a go, it did way more stuff than I wanted it to
I don't know, do you want a service worker?
 
I dont even know what they are
 
it really should have documented this
 
I watched a YouTube crash course video
 
or at least the example would make it obvious by including a particular JS file
 
2:13 PM
that's how I learned the React basics
 
I have great disdain for learning technical topics on youtube when it comes to specific tutorials on code
 
He never discussed build/deployment
 
great for high level concepts, awful for nuts and bolts getting down to it
 
okay well I'll just have to do some research I guess
thanks for your help
 
anyway in my experience Babel outright states what the output file it generated is called in the terminal
mainly so it can boast how large/small it is and how quickly it did it
 
2:15 PM
lol
 
2:33 PM
@TomJNowell After I fetch the script, what's the best way to put it in my app?
Traditionally I would find a certain script ID and insert the contents in a <script></script> after that script ID
I guess I can just append it to the bottom of my APP container
 
3:33 PM
@TomJNowell Fetch isnt working because of CORS
 

« first day (3079 days earlier)      last day (1861 days later) »