Material UI CDN example is not working which is provided in github. Below is for the same .
https://github.com/mui-org/material-ui/blob/master/examples/cdn/index.html
It is giving an error that "require is not defined" from material UI CDN . Yesterday it was working . Today it is not working . Looks like material UI CDN is not working .
Try the below link:
if you are using react+material-ui
https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js
https://unpkg.com/#material-ui/core/umd/material-ui.development.js
THERE ARE TWO WAYS:
if you are using require function in your js then remove it as it is server side function not client side.
Else you can use require.js cdn link (mentioned above) in your client side before your script.
Related
I love React, it has quickly become my favorite development tool. It is a fantastic library that creates the kind of flexibility I've always dreamed about.
That said, I'm having a very hard time getting Facebook login to work with React in production.
I have tried all of the following methods. In all three cases, I implemented the examples exactly as shown in the code using the simplest possible technique:
https://github.com/seeden/react-facebook
https://github.com/keppelen/react-facebook-login
http://jslancer.com/blog/2017/11/27/facebook-google-login-react/
Everything works great in development. :)
When I create the production build using create-react-app and push it live, it breaks and reports: Error: Facebook is not initialized or Uncaught TypeError: Cannot read property 'login' of undefined where undefined is FB.
Basically it seems like the Facebook javascript SDK is not loaded or initialized.
The first two links above are for existing component libraries, but the third is a custom implementation that places the Facebook initialization code in the index.html file and creates an event listener. The results are the same in all three examples.
It is as if something about the create-react-app compression method is obfuscating the variables to the point that Facebook can no longer work, or at least is not available to the react code. This includes all calls to window.FB as recommended in many tutorials.
I've been working at this for a couple of weeks now (off and on) and am now turning to the hive mind. Anyone have any ideas on how to get Facebook to actually work with Facebook's own code library (React)? It seems so painfully odd that it causes this much trouble and I have been unable to find a clear solution that works in production.
Most of the debugging steps are already mentioned in the comments section.
Here are the steps laid down:
1) Check the network tab in your browser's console and see if the request to load FB's SDK is successful or not
2) Most common culprit is some extension like Ad-Blocker blocking such async requests which loads JS on your web page. Disable it or try it incognito mode
3) Other common mistake I have seen is forgetting to use the FB.init({ // config }); function - which is the actual call which initializes the fb sdk and makes available the FB variable globally.
I am trying to use Inferno to render on the server. The documentation inferno-server and server-side-rendering does not say show to set-up babel & run the sever.
All I could find is InfernoJS Babel Plugin but noting about running it on Node.
Any help would be appreciated.
Could you explain what you mean by "Running on node"?
Inferno Babel plugin converts the JSX code into a regular JS code, which runs without problems on node (the server uses renderToString). While you are not using browser elements (document and other tools), everything should be fine.
Then you need to make a separate component for the client, which when requested will be given as a bundle along with the html page, and then using hydrate function to "cling" into webpage and bind items.
you can check my repository (although this is for TypeScript): https://github.com/MrFoxPro/inferno-isomorphic-tempalte
Our application is a React/Node app built with Webpack and renders server side in production. In this production scenario, the mapbox-gl package has a problem loading on the server side. I suspect this has something to do with the way mapbbox-gl.js is an already browserified library, and doesn't play well with this server side environment that is built with webpack. Below is the relevant error when I try to load the page for the first time and we don't get any of the component's html generated on the server side (though everything works when it then loads in the browser client).
The relevant line of code in mapbox-gl.js that generates the error at the top of the stack reads "module.exports=self;".
Node app is running on port 5000
ReferenceError: self is not defined
at Object.112 (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:225:29)
at s (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:602)
at eval (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:653)
at Object.110../window (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:221:25)
at s (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:602)
at eval (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:653)
at Object.24.../package.json (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:48:26)
at s (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:602)
at e (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:773)
at eval (webpack:///./~/mapbox-gl/dist/mapbox-gl.js?:1:791)
Hopefully there are some tweaks I can add to our webpack build config to make this work. Sorry there isn't a lot of info here, I'm hoping that someone has come across this problem and there might be an easy fix.
Actually, when it comes to server-side rendering, this kind of scenario is very common which is some library rely on DOM exist or browser environment.
Solution:
1. In the webpack configuration, define a variable for indicating whether the application is running on server side.
new webpack.DefinePlugin({
__CLIENT__: true
// Other global variables
}),
2. Inside the files that using the mapbox library
let mapboxGl;
if (__CLIENT__) {
mapboxGl = require('mapbox-gl')
}
3. Server side entry code
global.__CLIENT__ = false;
4. For using webpack for both client-side and server-side, using webpack-isomorphic-tools
I was facing the same problem on Nuxt.js. In order to solve this problem the mapbox package should be imported on the client side only.
Here's the code:
let mapboxgl;
// Check if the process is on the client side
if (process.client) {
mapboxgl = require('mapbox-gl');
}
I am creating the app for the offline maps in iphone . I want to select the two plces and draw the route among the selected places . I found this link
http://www.gisnotes.com/wordpress/category/sqlite3/. When i am following the steps , i didnt found this map2sqlite-1.0.tar.bz2.even though i got it from other . but the database is not created , in the second step . in the above link . I found the route me third party api, but i am not understanding how to use it . Can anyone sugget me how to create the offline maps
It is now on Github map2sqlite.
I'm using objective c gdata client and I have a problem with GTMOAuth2ViewControllerTouch. It was working for me (shows UI, returns callbacks), but now it shows just empty white screen. Any ideas?
So, I have found a solution. It seems to be a wrong build configuration for gdata static library. So I have unset GTM_INCLUDE_OAUTH2 to not include gtm auth controllers to static library and then add this classes directly to application. gtm auth can be found here.
You have to add the GTMOAuth2ViewControllerTouch.xib in your project