I am facing a big problem with create-react-app
environment on trying to run my application inside a Smart TV browser.
Specification TV and browser (http://whatismybrowser.com)
Here is what I am trying to:
create-react-app
projectyarn build
yarn global add serve && serve -s build
http://<my-lan-ip>:5000
(5000 port as default port provided by serve
command)When I follow these steps I get a blank page. The blank page only occours in a TV browser. On PC and Mobile runs fine.
So I am wondering and ask here to have some share thoughts:
Anyone have already face this problem? Any solution or No, it is not possible?
EDITED: Solution
Thanks to @Rikin and @JoeClay I came up with a solution. First, after download the Chrome version 23, I could see the problem is polyfills (Set and Map).
So after install yarn add core-js --dev
and yarn add raf --dev
.
Update src/index.js
import 'core-js/es6/map'; // <-- added this line after installed packages
import 'core-js/es6/set'; // <-- added this line after installed packages
import 'raf/polyfill'; // <-- added this line after installed packages
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
Also, the portion of React Docs which helped to find this solution.
Newer versions of React (v16+) require:
Map
and Set
data structureswindow.requestAnimationFrame()
APIAccording to MDN, basic Map and Set support weren't added to Chrome until version 38, and you had to use a vendor prefix to access requestAnimationFrame
until Chrome 24.
Since your TV uses Chrome 23, you'll need to polyfill those APIs. The React docs suggest using core-js
or babel-polyfill
for this purpose.
If your desired aim is to have your app run just on a smart TV perhaps give react-tv
a look: https://github.com/raphamorim/react-tv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With