-
Notifications
You must be signed in to change notification settings - Fork 829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to have self.__WB_MANIFEST available in another file #2401
Comments
Does this example help? |
webpackCompilationPlugins:[
{
apply (compiler) {
compiler.hooks.emit.tapPromise('ManifestWorkboxWebpackPlugin', async compilation => {
console.log("FIRST ONE");
})
}
},
]
|
The fix that was just merged in #2400 may also be relevant to this use case. I'd imagine we'll cut a |
This might be it. what do you suggest me to do for now to figure this out ? |
I added this code in if (Array.isArray(this.config.webpackCompilationPlugins)) {
console.log("this is array");
for (const plugin of this.config.webpackCompilationPlugins) {
console.log(plugin);
plugin.apply(childCompiler);
}
} but still, my emit hook not gets called. :( |
I put the apply plugin out of the |
Let's move this conversation over to #2383 (comment), which tracks an "official" solution. |
Library Affected:
InjectManifest plugin
Browser & Platform:
Latest.
Issue or Feature Request Description:
@jeffposnick @philipwalton
I am using
InjectManifest
plugin. All seems great. I have the latest workbox plugin which meansInjectManifest
haschildCompiler
and all that stuff already implemented.Now, what I need is I want
self.__WB_MANIFEST
to be also available in one of my other files such asapp.js
which is the entry point. So the flow is like this:app.js
is the main entry in webpack, whatever that file imports gets built and in the plugins of webpack, as I said I also haveInjectManifest
plugin. What I need is that if inapp.js
, I writejs console.log(self.__WB_MANIFEST)
, I want it to print a manifest too.The reason is that I want to use that manifest for other situations as well in my src code. I found
webpackCompilationPlugins
this option, but I couldn't make it work as i don't have manifest in one of the plugins I might put in that option.ONE POSSIBLE SOLUTION:
const manifest = [];
// this code is somewhere at the top of the webpack.The actual thing is, hooks.emit.tap never runs. apply function runs, but not the hooks. and
emit
hook is the one i really need. I tried shouldEmit , but still no luck. Any idea?make
hook works, but at that time, i don't have manifest. All the hooks are running includingmake
, but aftermake
hook, none of them really get run.The text was updated successfully, but these errors were encountered: