Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sw.js 404 when using publicPath #7

Closed
andrevandal opened this issue Oct 30, 2017 · 3 comments
Closed

sw.js 404 when using publicPath #7

andrevandal opened this issue Oct 30, 2017 · 3 comments

Comments

@andrevandal
Copy link

andrevandal commented Oct 30, 2017

Hi, i'm using github pages to host and I got 404 error on sw.js.

A bad HTTP response code (404) was received when fetching the script.
/sw.js Failed to load resource: net::ERR_INVALID_RESPONSE
(index):1 Uncaught (in promise) TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.

Nuxt config:

module.exports = {
  /*
  ** Build configuration
  */
  build: {
    publicPath: 'https://derevandal.github.io/idepead-subscription-frontend/',
  }
}

I believe this happens because the script is not injected into the page with publicPath.

Could anyone help me?
Thanks

This question is available on Nuxt.js community (#c8)
@pi0
Copy link
Member

pi0 commented Nov 16, 2017

Hi. Would you please check against new 2.0.0 release? If problem still exists, providing generated .nuxt/sw.plugin|template.js and static/sw.js files may help.

@pi0 pi0 changed the title SW.js 404 sw.js 404 when using publicPath Nov 16, 2017
@james2doyle
Copy link

james2doyle commented Dec 8, 2017

I fixed this by creating a symbolic link from the template to the main file:

ln -s $PWD/.nuxt/sw.template.js $PWD/.nuxt/sw.js

This way, the sw.js is always synced to whatever sw.template.js is

@TheAlexLichter
Copy link
Member

Should be resolved since #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants