Skip to content
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

Fix bin/webpack when ui-classic not bundled #9293

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/webpack
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ end
# If nodejs is compiled with openssl 1.1, then this flag is not available
# and will fail if we hardcode it into NODE_OPTIONS
#
# This can be removed once we upgrade webpack as then we don't need the
# flag anymore.
has_legacy_openssl = system('node --help | grep -qs "\\--openssl-legacy-provider"')
# This can be removed once we upgrade from webpack 4.0 to 5.0
`node --openssl-legacy-provider -v`
# if node supported this flag, then the command return status (i.e.: $? ) will be successful
has_legacy_openssl = $?.success?
node_options = "--max_old_space_size=4096"
node_options << " --openssl-legacy-provider" if has_legacy_openssl

Expand Down
3 changes: 2 additions & 1 deletion config/webpack/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { readFileSync } = require('fs');
const configPath = resolve('config', 'webpacker.yml');
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];

const { output: outputRoot, engines } = require('./paths.json');
const { output: outputRoot, i18n, engines } = require('./paths.json');

function removeOuterSlashes(string) {
return string.replace(/^\/*/, '').replace(/\/*$/, '');
Expand All @@ -32,5 +32,6 @@ module.exports = {
settings,
env,
output,
i18n,
engines,
};
4 changes: 2 additions & 2 deletions config/webpack/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
const { SplitChunksPlugin } = require('webpack').optimize;
const { execSync } = require('child_process');

const { env, settings, output, engines } = require('./configuration.js');
const { env, settings, i18n, output, engines } = require('./configuration.js');
const loaders = require('./loaders.js');
const RailsEnginesPlugin = require('./RailsEnginesPlugin');

const extensionGlob = `**/*{${settings.extensions.join(',')}}*`; // */
const entryPath = join(settings.source_path, settings.source_entry_path);
const moduleDir = engines['manageiq-ui-classic'].node_modules;

const gettextDir = execSync('bundle info --path gettext_i18n_rails_js', { encoding: 'utf-8' }).trim();
const gettextDir = i18n;

const sharedPackages = [
'@carbon/icons-react',
Expand Down
3 changes: 3 additions & 0 deletions lib/tasks/manageiq/ui_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ namespace :webpack do
end

task :paths do
i18n_path = Bundler::CLI::Common.select_spec("gettext_i18n_rails_js").full_gem_path

json = JSON.pretty_generate(
:info => "This file is autogenerated by rake webpack:paths, do not edit",
:output => Rails.root.to_s,
:i18n => i18n_path,
:engines => asset_engines.map { |p|
key = p.namespace
value = {:root => p.path,
Expand Down