PokeAPI / pokeapi-js-wrapper

PokeAPI browser wrapper, fully async with built-in cache
Mozilla Public License 2.0
273 stars 43 forks source link

Service Worker installation failed #21

Closed LuziferSenpai closed 3 years ago

LuziferSenpai commented 3 years ago

Hey,

I got this error when npm starting my ReactJS Project.

OMException: Failed to register a ServiceWorker for scope ('http://localhost:3000/') with script ('http://localhost:3000/pokeapi-js-wrapper-sw.js'): The script has an unsupported MIME type ('text/html').

const Pokedex = require("pokeapi-js-wrapper")

const P = new Pokedex.Pokedex({cacheImages: true})
Naramsim commented 3 years ago

Your webserver is adding the wrong MIME type to the response. I suggest you to not add any MIME type or add a correct one (text/javascript).

Read more on MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#textjavascript