service worker does not install reactjs
up vote
0
down vote
favorite
Good evening, I'm trying to work with Reactjs and ServiceWorker to create a PWA but when creating a new project everything seems to work fine but when running npm run build and dispatch the result with npm's http-server opens the application correctly but the browser never records that there is a service worker.
I have already dealt with 3 projects and different browsers but everything remains the same.
The projects are as they are installed with create-react-app.
Does anyone know why the service worker is not installed?
Attached image of how it is not registered by the browser even though it is in the build folder.
If I do this without using react as proof with a simple service worker file if I can register it but with reacrt I do not get it that way.
Thanks.
reactjs service-worker
add a comment |
up vote
0
down vote
favorite
Good evening, I'm trying to work with Reactjs and ServiceWorker to create a PWA but when creating a new project everything seems to work fine but when running npm run build and dispatch the result with npm's http-server opens the application correctly but the browser never records that there is a service worker.
I have already dealt with 3 projects and different browsers but everything remains the same.
The projects are as they are installed with create-react-app.
Does anyone know why the service worker is not installed?
Attached image of how it is not registered by the browser even though it is in the build folder.
If I do this without using react as proof with a simple service worker file if I can register it but with reacrt I do not get it that way.
Thanks.
reactjs service-worker
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Good evening, I'm trying to work with Reactjs and ServiceWorker to create a PWA but when creating a new project everything seems to work fine but when running npm run build and dispatch the result with npm's http-server opens the application correctly but the browser never records that there is a service worker.
I have already dealt with 3 projects and different browsers but everything remains the same.
The projects are as they are installed with create-react-app.
Does anyone know why the service worker is not installed?
Attached image of how it is not registered by the browser even though it is in the build folder.
If I do this without using react as proof with a simple service worker file if I can register it but with reacrt I do not get it that way.
Thanks.
reactjs service-worker
Good evening, I'm trying to work with Reactjs and ServiceWorker to create a PWA but when creating a new project everything seems to work fine but when running npm run build and dispatch the result with npm's http-server opens the application correctly but the browser never records that there is a service worker.
I have already dealt with 3 projects and different browsers but everything remains the same.
The projects are as they are installed with create-react-app.
Does anyone know why the service worker is not installed?
Attached image of how it is not registered by the browser even though it is in the build folder.
If I do this without using react as proof with a simple service worker file if I can register it but with reacrt I do not get it that way.
Thanks.
reactjs service-worker
reactjs service-worker
asked yesterday
OscarDev
829
829
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday
add a comment |
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Does you import your SW in the App entry point module? Example:
// index.js:
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
add a comment |
up vote
0
down vote
Thanks partners. I was able to solve it by modifying in line src / index.js the line 1 that I had:
serviceWorker.unregister();
By: serviceWorker.register();
And now it works.
Regards!
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Does you import your SW in the App entry point module? Example:
// index.js:
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
add a comment |
up vote
0
down vote
Does you import your SW in the App entry point module? Example:
// index.js:
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
add a comment |
up vote
0
down vote
up vote
0
down vote
Does you import your SW in the App entry point module? Example:
// index.js:
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
Does you import your SW in the App entry point module? Example:
// index.js:
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
answered yesterday
Sviat Kuzhelev
931215
931215
add a comment |
add a comment |
up vote
0
down vote
Thanks partners. I was able to solve it by modifying in line src / index.js the line 1 that I had:
serviceWorker.unregister();
By: serviceWorker.register();
And now it works.
Regards!
add a comment |
up vote
0
down vote
Thanks partners. I was able to solve it by modifying in line src / index.js the line 1 that I had:
serviceWorker.unregister();
By: serviceWorker.register();
And now it works.
Regards!
add a comment |
up vote
0
down vote
up vote
0
down vote
Thanks partners. I was able to solve it by modifying in line src / index.js the line 1 that I had:
serviceWorker.unregister();
By: serviceWorker.register();
And now it works.
Regards!
Thanks partners. I was able to solve it by modifying in line src / index.js the line 1 that I had:
serviceWorker.unregister();
By: serviceWorker.register();
And now it works.
Regards!
answered yesterday
OscarDev
829
829
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372643%2fservice-worker-does-not-install-reactjs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You might need to disable the HTTPS security verification. Services workers only work in HTTPS.
– ChrisR
yesterday