Skip to content

9.x.x, Webpack, and Service Workers #5730

Answered by adamhari
eliw00d asked this question in Q&A
Discussion options

You must be logged in to vote

Here's what I did to build the firebase-messaging-sw.js file with webpack (I'm not sure if this works because I'm having other issues with Firebase, I would be interested in knowing):

  1. Add an additional item in the config's entry collection for the firebase-messaging-sw.js file. We do this because we want to bundle and output it separately from the rest of the app's files.
entry: {
  ...,
  'firebase-messaging-sw': path.join(__dirname, './web/firebase-messaging-sw.ts'),
}
  1. Change your output.filename config if needed so that the service worker entry's output file is named correctly. Mine is doing something like this:
pathData => {
  return pathData.chunk.name === 'firebase-messaging-sw…

Replies: 1 comment 15 replies

Comment options

You must be logged in to vote
15 replies
@adamhari
Comment options

@eliw00d
Comment options

@eliw00d
Comment options

@adamhari
Comment options

@eliw00d
Comment options

Answer selected by eliw00d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants