-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
feat(plugin-webpack): improve native asset relocation without forking Vercel loader #2320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love that this is net negative lines of code (before tests)!
Codecov Report
@@ Coverage Diff @@
## master #2320 +/- ##
==========================================
+ Coverage 72.19% 74.59% +2.40%
==========================================
Files 76 77 +1
Lines 2287 2299 +12
Branches 437 436 -1
==========================================
+ Hits 1651 1715 +64
- Misses 473 476 +3
+ Partials 163 108 -55
Continue to review full report at Codecov.
|
For reference, here is the PR to fix the issue in the html-webpack-plugin. |
Hopefully this will fix a number of other issues including jprichardson/node-fs-extra#863 |
@ivancuric you can try this loader to confirm. |
It does! I was hoping it would also fix #1276, and it does somewhat. It previously crashed during compilation of preload scripts:
Now the app compiles, but the output seems to be missing one level — it's not in the
|
Native modules end up in 3 different locations depending on where they are loaded from:
If you share a repository I can probably tell you what's going on rather than guess! |
Oof. I'll see if I can make a minimal repro since it's a pretty big private repo for a commercial project. Adding
I actually got it working (somewhat) with #1250 (comment) but I honestly have no idea what's going on there 😅 It also doesnt' really work since it breaks on reload, but I'll continue this conversation there. |
Here's a repro repo! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it's good, I have mostly style / refactor suggestions.
Ultimately I think the tests could be refactored to be a little more DRY. I can do that work.
packages/plugin/webpack/test/fixtures/apps/native-modules/src/index.html
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately CI / mocha is lying to us, there are definitely test failures. I fixed some but there's two failures checking for the asset relocator patch plugin in the preload config.
Just fixed those. The loader requires no modification to work in the preload so the plugin should not be loaded in those cases. |
This PR adds a plugin to renderer webpack configurations that patches the code injected by
@vercel/webpack-asset-relocator-loader
so that it works with Electron/forge.Main and preload configurations already work without patching!
Closes #2328.
Closes #2154.
Closes #1688.
Closes #1451.
Closes #1424.
Closes #1224.