gopangolin / wp-reactivate Goto Github PK
View Code? Open in Web Editor NEWReact boilerplate for WordPress plugins
License: GNU General Public License v3.0
React boilerplate for WordPress plugins
License: GNU General Public License v3.0
My app folder weights 110Kb, however the final shortcode.js file is almost 700Kb.
I have tried source-map-explorer in order to analyze the prod files. But the analysis doesn't give anything. I suspect for the following reason described in the package page:
"For source-map-explorer to be useful, you need to generate a source map which maps positions in your minified file all the way back to the files from which they came.
If you use browserify, you can generate a JavaScript file with an inline source map using the --debug flag:
browserify -r .:foo --debug -o foo.bundle.js
source-map-explorer foo.bundle.js"
How can I lower the weight of my prod .js file?
Or any chance I can eject the config in order to add the --debug flag?
I am trying to add React Tostify module on a clean install of your plugin as a shortcode and I have problems loading the css file from this module. I am loading the css file in shortcode.jsx via:
import 'react-toastify/dist/ReactToastify.css';
I get the following error:
Uncaught Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
.Toastify__toast-container
I've tried putting the css file in the same folder as the shortcode and play around with webpack.config.js but nothing seems to work. Any advice would be appreciated.
Hi awesome plugin this has been such a huge help for some projects that I have been working on. The only issue that I am having is when trying to move the plugin out from a sub item under Settings to its own admin menu item. Any ideas on how to go about this? Your help would be greatly appreciated thanks!
How to create a final independent plugin build zip?
Hello fellow developers!
Is there any Typescript support ? I tried to implement it myself but failed :(
I tried following this: https://webpack.js.org/guides/typescript/ but it didn't work and spew a bunch of errors out.
ERROR in ./app/shortcode.ts 11:75
Module parse failed: Unexpected token (11:75)
File was processed with these loaders:
* ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| for (var i = 0; i < shortcode_containers.length; ++i) {
| var objectId = shortcode_containers[i].getAttribute('data-object-id');
> ReactDOM.render(wpObject, (_a = { window: window }, _a[objectId] = , _a) / > , shortcode_containers[i]);
| }
| });
Hope someone can help me :)
Visiting this directory /wp-admin/options-general.php?page=wp-reactivate
on my local Wordpress install throws this error in the console:
Admin.jsx:16 Uncaught TypeError: Cannot read property 'api_url' of undefined at
Admin._this.getSetting (Admin.jsx:16)
The error is referring to this function:
getSetting = () => {
fetch(`${this.props.wpObject.api_url}settings`, {
credentials: 'same-origin',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-WP-Nonce': this.props.wpObject.api_nonce,
},
})
.then(response => response.json())
.then(
(json) => this.setState({ settings: json.wpreactivate }),
(err) => console.log('error', err)
);
};
Hi there,
Sorry if I'm asking something obvious. I'm a newbie to working with wordpress.
There is nothing about routing in the documentation or setup. Can you guys elaborate on that a bit?
For example let's say my plugin is loaded at /myplugin
(http://my-site-url.com/myplugin
) by wordpress. And the sub-routes of /myplugin
is handled by react-router e.g. /myplugin/myroute1
(http://site-url.com/myplugin/myroute1
) or /myplugin/myroute2
(http://site-url.com/myplugin/myroute2
) etc which works fine (for me without an issue using react-router-dom project).
However, wordpress yields "OOPS! THAT PAGE CAN’T BE FOUND." when I try to load the site directly with a subroute in the address bar e.g. http://site-url.com/myplugin/myroute2
.
Thanks.
#Hi,
When I change the code the for widget, it doesn't update it when I refresh the page. For example when I add a react component to the widget view and refresh the page, there are no changes. Even when I add plan html there are no changes.
I rebuild the project but no luck. Any ideas?
EDIT: -----
It was an issue with another part of my setup
Changes to the admin panel are not showing up under settings. Even after I run the build command.
Expecting the following to show up on the admin panel:
```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.