-
Notifications
You must be signed in to change notification settings - Fork 917
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
Fixes to make web frameworks work for plugin #6000
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.
I don't love string-replace-loader, as it feels a bit hacky + fragile, but I trust your judgement on whether it is the best choice here.
firebase-vscode/webpack.common.js
Outdated
strict: true | ||
}, | ||
{ | ||
search: "require(path", |
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.
This feels quite fragile - consider at least adding some explicit comments inframeworks/utils.ts
warning about this string replace
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.
Added a comment.
I think the most robust choice is probably to use |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6000 +/- ##
==========================================
+ Coverage 54.94% 55.03% +0.08%
==========================================
Files 342 339 -3
Lines 23264 23220 -44
Branches 4754 4746 -8
==========================================
- Hits 12783 12779 -4
+ Misses 9351 9311 -40
Partials 1130 1130
☔ View full report in Codecov by Sentry. |
Actually I switched to using a conditional, it's not great either but it's less fragile than the string replace. It checks to see if Let me know what you think. |
WebFrameworks
insrc/frameworks/index.ts
was supposed to be imported from the newframeworks.ts
file which uses imports (stable, bundleable) instead of runtime requires (causes problems in webpack bundle for VSCode plugin). James told me this was probably a bad rebase and it should have been checked in.A couple of places in the CLI code use
require
, but after being run through webpack, it replaces it with webpack's own require, which works slightly differently (mainly, it expects modules only, not files). There are 2 workarounds for this.createRequire(import.meta.url)
but unfortunately you can't useimport.meta.url
unless thetarget
is changed fromcommonjs
tonode16
ornodenext
, which I don't think the CLI codebase is ready for.require
at compile time with__non_webpack_require__
. TS hates this so we need a@ts-ignore
, and we don't want to replace all instances ofrequire
(the webpack one works fine and probably better on actual modules), just specific ones.