I am using create-react-app npm to install react js application. I am trying to use firebase in the project. I am following firebase integration in reactjs tutorial. I have done all things correctly. But I am not certain where is webpack config file. I tried inserting
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
plugins: [
….
new ServiceWorkerWebpackPlugin({
entry: path.join(__dirname, './firebase-messaging-sw.js'),
})
]
Above code snippet to node_module/react-scripts/scripts/webpack.config.dev.js. But cannot get working.
I am upto asking for permission to user and after allowing the permission I see the following error.
browserErrorMessage : "Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html')."
code:"messaging/failed-serviceworker-registration"
message:"Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').
What is the error related to and how to solve it?