Replies: 1 comment 3 replies
-
|
When you want to emit assets you have to use For example if you want to generate icons and manifest file you can register two hooks with different stage:
You can find more them here - https://github.com/webpack/webpack/blob/main/lib/Compilation.js#L5744, their names describe when they are best used. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Basically I need to create a PWA manifest as a part of the build.
I surmised since it doesn't involve taking actual input files to transform, but has to output one or more
.jsonfiles, it has to be a plugin and not a loader.A lot of fields in the manifest are just strings, so those can be passed through options, but certain fields, like
iconsandscreenshotsdescribe assets and therefore can be sent through the build pipeline, resulting in a.jsonfile, the path to which should be accessible in the code (to put its path into<link>element at least).It will also have to implicitly prefix fields like
scopeandshortcutswithpublicPath.Suppose majority of the of the fields do not depend on any compilation state, so they can be created at the top level of
apply()method. But what abouticons? Presume the options will provide a source icon file path, which is most likely going to be used in the main codebase and the final processed path added to the manifest. Same logic withscope. But then I'll have to create the manifest file as an assets and somehow get those final paths in its hook callback.There are quadrillion hooks listed in the docs and I have no idea where to even start and the writing plugin page has a strong "How To Draw an Owl" vibe.
Beta Was this translation helpful? Give feedback.
All reactions