Service Worker registration error: Unsupported MIME type ('text/html')

前端 未结 12 1334
梦如初夏
梦如初夏 2020-12-05 17:44

I\'m using create-react-app with an express server.

create-react-app has a pre-configured ServiceWorker that caches local assets (https://github.com/fac

12条回答
  •  没有蜡笔的小新
    2020-12-05 18:09

    The script has an unsupported MIME type ('text/html'). Failed to load resource: net::ERR_INSECURE_RESPONSE (index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').

    Code for template.js root file

    export default ({ markup, css }) => {
      return `
          
            
              
              
              MERN Marketplace
              
              
    
              
              
            
            
                
    ${markup}
    `; };

提交回复
热议问题