core
core copied to clipboard
feat(fetch-hook): extending fetch hook usage
Description
Update to use the fetch hook, if specified, when fetching remoteEntries and chunks on node, in order to achieve similar effect to what was possible with webpackChunkLoad before.
Types of changes
- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
Checklist
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [ ] I have updated the documentation.
This is a rather rough bare minimum proposal, that resolved the specifc issues I was having. Namely needing to switch out fetch for Axios, or just to extend fetch, when doing any ssr network calls. Updating to make the new strategies work with webpackChunkLoad would also work for me, but I thought extending the new hook was likely better.
can you not use createScript hook?
@zhoushaw any comments here?
@ScriptedAlchemy I tried using createScriptHook initially, but it doesn't actually seem to be used on the node side of things. createScriptNode calls createScriptHook, but then only uses the result to reassign the url value, and then uses fetch to fetch that url. On the node generation side, httpVmStrategy uses the node http library with no apparent way to override either.
If create script hook isnt working on node side then we should just need to ammend the source code so it does call the hook, dont think we need to add another api for this if we can make the existing one work node side
Stale pull request message