aneagoie / robofriends-pwa Goto Github PK
View Code? Open in Web Editor NEWZTM tutorial - adding PWA capabilities to a react app
Home Page: https://aneagoie.github.io/robofriends-pwa/
ZTM tutorial - adding PWA capabilities to a react app
Home Page: https://aneagoie.github.io/robofriends-pwa/
When opening the link aneagoie.github.io/robofriends-pwa/ in chrome browser, no link are shown to install the PWA to desktop. When running Lighthouse in chrome devtools this message appears:
This page is controlled by a service worker, however the start_url
(https://aneagoie.github.io/?source=pwa) is not in the service worker's scope (https://aneagoie.github.io/robofriends-pwa/)
Maybe the /robofriends-pwa/
are missing in start_url
inside manifest.json
Well, I've spent nearly three hours on figuring out what the heck with robofriends and why I can't manage to set a service-worker work. As it turned out.... you should install all those packages:
npm install [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
It's relevant today.... the other day you may need to run npm update
then, you need to copy three files (you may download from my repo)
https://github.com/hazartilirot/robofriends-pwa/tree/main/src
reportWebVitals.js
service-worker.js
serviceWorkerRegistration.js
Once you finished. Open your index.js and import two dependencies
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import reportWebVitals from './reportWebVitals';
Below
ReactDOM.render(
<React.StrictMode>
<Provider store={ store } >
<App />
</Provider>
</React.StrictMode>,
document.getElementById('root')
);
Insert the following code:
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.register();
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
In case you're wondering how I get the info. You may create any directory, enter to it and run the command
npx create-react-app my-app --template cra-template-pwa
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.