-
Notifications
You must be signed in to change notification settings - Fork 994
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
Refs #37102 - detect plugins webpack by looking for remoteEntry.js #10025
Conversation
For devel setups and Debian this works by checking |
062c2fe
to
43ee257
Compare
def uses_webpack? | ||
path && (File.file?(File.join(path, 'webpack', 'index.js')) || webpack_manifest_path.present?) | ||
path && (File.file?(File.join(path, 'webpack', 'index.js')) || webpack_manifest_path.present? || webpack_remote_entry.present?) |
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.
arguably, webpack_manifest_path.present?
can be dropped now
also, this method hits the disk on every page load, we should cache the result in memory (but scope creep!)
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.
Which is exactly what I aimed at in #9834 (comment) but I should have pushed further on this.
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.
you mean "hits the disk" part?
With this applied I get working Katello prod installs with Webpack 5 \o/ |
def uses_webpack? | ||
path && (File.file?(File.join(path, 'webpack', 'index.js')) || webpack_manifest_path.present?) | ||
path && (File.file?(File.join(path, 'webpack', 'index.js')) || webpack_manifest_path.present? || webpack_remote_entry.present?) |
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.
When is path && (File.file?(File.join(path, 'webpack', 'index.js'))
false? I only see it as true all the time
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.
when we use RPMs as we do not ship the webpack
folder at all there, as we do not need to compile anything from it on the system where we deploy.
@@ -30,8 +30,13 @@ def webpack_manifest_path | |||
File.file?(manifest_path) ? manifest_path : nil | |||
end | |||
|
|||
def webpack_remote_entry | |||
remote_entry_path = File.join(path, 'public', 'webpack', id.to_s, "#{id}_remoteEntry.js") |
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.
probably should do the -
-> _
change for tasks here
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.
Good catch! Updated
43ee257
to
d3324ea
Compare
Since we switched to Webpack 5, there are no more manifest.json in the plugins webpack folder, but we need some token to detect that we gotta load webpack stuff.
d3324ea
to
27871fb
Compare
[test unit] seems unrelated |
Since we switched to Webpack 5, there are no more manifest.json in the plugins webpack folder, but we need some token to detect that we gotta load webpack stuff.