Solvedworkbox [v5.0.0-beta.1] Can't find self.__WB_MANIFEST in your SW source

Library Affected:
workbox-webpack-plugin

Browser & Platform:
all browsers

Issue or Feature Request Description:
The issue has been introduced in v5.0.0-beta.1

During compilation:

ERROR in Can't find self.__WB_MANIFEST in your SW source.

if I set the injectionPoint explicitly with the default value (injectionPoint: '__WB_MANIFEST'), the error is different

ERROR in Can't find data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvY29yZS1qcy9pbnRlcm5hbHMvYS1mdW5jdGlvbi5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2ludGVybmFscy9hLWZ1bmN0aW9uLmpzPzFjMGIiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgaWYgKHR5cGVvZiBpdCAhPSAnZnVuY3Rpb24nKSB7XG4gICAgdGhyb3cgVHlwZUVycm9yKFN0cmluZyhpdCkgKyAnIGlzIG5vdCBhIGZ1bmN0aW9uJyk7XG4gIH0gcmV0dXJuIGl0O1xufTtcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQURBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=/n/# in assets.
18 Answers

✔️Accepted Answer

Your swSrc shows:

precacheAndRoute(__WB_MANIFEST)

By default, you need to use self.__WB_MANIFEST:

precacheAndRoute(self.__WB_MANIFEST)

(Unless you set injectionPoint: '__WB_MANIFEST', like you said.)

Apologies if this specific requirement caught you out while testing the beta releases, especially since we don't have the documentation in place yet. That's the default injectionPoint that we're going with in v5 across all the build tools.

And again, the second error you encountered, once you got the injectionPoint configuration resolved, should be addressed by #2251.

Other Answers:

I have encountered the same error whilst using webpack-workbox-plugin with the InjectManifest function.
Adding literally just self.__WB_MANIFEST to the bottom of my Service Worker file seems to have fixed it. I guess the plugin code expects to find this variable in the file and doesn't like it when it isn't there. It seems odd that I need to add this (seemingly useless, since I'm not interested in precaching) piece of boilerplate code into my service worker. Is the plugin really not able to do this? It also isn't in the documentation anywhere that I'd expect it to be. e.g. https://developers.google.com/web/tools/workbox/guides/precache-files/webpack

Related Issues:

46
workbox Precache manifest missing entries when recompiled via webpack --watch
A similar approach as per @devarthurribeiro but through the disable option: Library Affected: workbo...
18
workbox Link to TypeScript definitions for workbox-sw
@Manc First you don' have to add anything to your tsconfig.json file Library Affected: workbox-sw Br...
13
workbox [v5.0.0-beta.1] Can't find self.__WB_MANIFEST in your SW source
Your swSrc shows: By default you need to use self.__WB_MANIFEST: (Unless you set injectionPoint: '__...
3
workbox Recommended Approach for Refreshing Page on new SW
Well I don't think that this is an advanced recipe I mean If you want to use workbox to precache you...
89
react boilerplate WebpackDevServer breaks on complex nested routes
Add the publicPath to your output option in your webpack config: Was running into this for a few day...
46
react boilerplate Sagas are injected twice!?
This is my current approach of making sure sagas are injected only once For some reason the sagas ar...
40
react boilerplate server is permanently running on port :3000 - not able to kill the process
Go to chrome://serviceworker-internals and chrome://appcache-internals search for localhost:3000 and...
34
react boilerplate Accessing environment variables in client-side code and creating builds for multiple environments
Thanks but it's not exactly what I'm looking for I've actually tried that approach but it requires d...
33
react boilerplate cross-env: command not found
npm install cross-env will fix your problems! I wonder why that's not installed… ...
25
react boilerplate RFC: Prettier
Prettier is definitely the must I will be more than happy to help with that But probably let's discu...
23
react boilerplate Webpack Error when trying to pack CSS
Hello! Do you have in webpack config loaders for css files? I have to include statically a library (...
20
react boilerplate How to load local font files (otf, ttf, woff, etc)
I think the file loader is only looking for imports in js files (not within css files) ...
18
react boilerplate How to configure App level saga?
Here is my solution for a global saga I could probably inject my global reducer here too ...
15
react boilerplate Global Variables are ignored
I'm still having a problem with this Getting warnings for every global variable I use I tried adding...
14
react boilerplate Cannot build when redux-form is imported
Ok so you need to use this on the form component: import { Field reduxForm } from 'redux-form/immuta...
12
react boilerplate [Question] How to pass route parameters through to a saga ?
How about page reload/refresh? locationBeforeTransitions is null if I reload. Imagine a scenario whe...
12
react boilerplate How to run a saga for a container that does not use react-router ?
I've had some trouble while implementing @bobkocisko solution and @learntoswim solution mainly becau...
12
react boilerplate anyone using redux-form with this ?
redux-form 5 doesn't work with immutableJS state out of the box I am trying to integrate redux-form ...
12
react boilerplate Errors when 'Building the Webpack DLL....'
Have you tried adding the dependency to internals/config.js in the exclude array? ...
8
gun TypeScript
Hello everyone I've published @types/gun. Hi what is your opinion about TypeScript TypeScript got a ...
6
react boilerplate Issue with adding meterial-ui library
This is great sokra himself is wanting to remove it it must have issues Thanks for the link @GGAlanS...
5
react boilerplate Overriding Bootstrap
I got it working You want to extract bootstrap.css from compiled main.js into compiled main.css ...
4
offline plugin SWs & Webpack
(text may have a lot of type because I wasn't re-reading/reviewing it) I actually been thinking abou...
3
offline plugin How to exclude a specific path and all the paths underneath from being cached?
/admin and all the paths underneath are not part of my app so I want to avoid the SW from caching th...
3
react boilerplate [Module not found: Error:] "Can't resolve" a component exported through an index.js
If it works fine in dev but not in production can you please try removing the new webpack.optimize.D...
3
react boilerplate Problem with integrating Semantic UI
Two bugs here: The one reported by @kfrajtak i believe is related to the fs module now being integra...
21
stencil JSX.IntrinsicElements error with typescript and react
for people struggling with this I've gotten things working this way eslint will shout about using de...
19
WebFundamentals ERROR: Failed to resolve: com.github.GoogleChrome.custom-tabs-client:customtabs:d08e93fce3
Okay.. sorry for referencing any of the contributors.. nothing is more frustrating than a failed bui...
19
create react pwa DOMException: unsupported MIME type for service worker
That's expected and my apologies that this can be confusing In a development environment ...
6
react universally Cannot add React-toolbox components
In addition to the right loader setup Hello I've been stuck for a while on this issue! I cloned the ...
5
stencil Rollup: Missing Export component is not exported
I managed to fix my issue using the following configuration in stencil.config.js: Notice how commonj...
15
next pwa Error on build "TypeError: Cannot read property 'tapPromise' of undefined"
Hi there this is weird I was facing the same issue but I actually make it work by using webpack 5 by...
11
msw server.use() or server.resetHandlers do not appear to be working within/between tests
I have tried as above and it works Let me know if I'm wrong Describe the bug server.use() or server....
8
msw Failed to construct 'Response': The status provided (0) is outside the range [200, 599]
Based on the amazing job done by @timdeschryver and other participants of this thread I've added a p...
7
next offline A bad HTTP response code (404) was received when fetching the script.
Guys I have been dealing with the same error and the way to fix it was as @hanford recommended ../ b...
6
msw Error: Error: connect ECONNREFUSED 127.0.0.1:80
Hi @slim-hmidi your configuration seams right :) Could I ask you to replace with and check then your...
4
msw Unable to be used alongside superagent
Technical details The issue is caused by the RequestOptions object supertest creates Unlike regular ...
4
msw How to deal with requests made before msw has been activated?
This should be re-opened The promise returned by start can resolve before the service worker is actu...
3
msw Question: why I cannot see my request even cannot see it x-powered-by: msw
I understand the issue I didn't see before @timdeschryver has right you should do has he suggested o...