Static export for integrating app into WP Plugin
Answered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
Hi, I have a small blog project i'm trying to integrate as a WP plugin. The app itself is working perfectly, fetching everything directly from WP using GraphQL and Apollo for the requests. The issue is that when I npm run build, I get a "static" folder under .next but my app expects a "main.js" and "main.css" - on the static folder I can't see any of those options, rather, only a lot of JS files (with hashed titles it seems) and one CSS file. Anyone has some experience with this? I tried some of the JS files on the dir, but I get a 404 (double checked the dir is fine and the file name is the same)
For your reference, the error code I'm having is (looks like it throws a 404 before even completing the request)
GET http://mysite.local/wp-content/plugins/blogql/.next/static/chunks/main-389da6851ad95fa2.js?ver=1.0.0 net::ERR_ABORTED 404 (Not Found)
(same thing for the css file, which I guess is the main one as it's the only file within the CSS folder under static)
GET http://mysite.local/wp-content/plugins/blogql/.next/static/css/d2e8c0cce181483a.css?ver=1.0.0 net::ERR_ABORTED 404 (Not Found)
Thanks so much
For your reference, the error code I'm having is (looks like it throws a 404 before even completing the request)
GET http://mysite.local/wp-content/plugins/blogql/.next/static/chunks/main-389da6851ad95fa2.js?ver=1.0.0 net::ERR_ABORTED 404 (Not Found)
(same thing for the css file, which I guess is the main one as it's the only file within the CSS folder under static)
GET http://mysite.local/wp-content/plugins/blogql/.next/static/css/d2e8c0cce181483a.css?ver=1.0.0 net::ERR_ABORTED 404 (Not Found)
Thanks so much
Answered by Saltwater Crocodile
If someone was to find this thread, the issue was that nginx was giving me a hard time having access to the files needed for the plugin. Creating a serve-static.php file and routing the resources from there directly did the trick.
1 Reply
Saltwater CrocodileOP
If someone was to find this thread, the issue was that nginx was giving me a hard time having access to the files needed for the plugin. Creating a serve-static.php file and routing the resources from there directly did the trick.
Answer