Skip to content

Commit

Permalink
Refs #37102 - detect plugins webpack by looking for remoteEntry.js
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
evgeni committed Jan 30, 2024
1 parent f0b1015 commit cf47b3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/registries/foreman/plugin/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ def webpack_manifest_path
File.file?(manifest_path) ? manifest_path : nil
end

def webpack_remote_entry
webpack_id = id.to_s.tr('-', '_')
remote_entry_path = File.join(path, 'public', 'webpack', webpack_id, "#{webpack_id}_remoteEntry.js")
File.file?(remote_entry_path) ? remote_entry_path : nil
end

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?)
end

private
Expand Down

0 comments on commit cf47b3c

Please sign in to comment.