diff --git a/bin/webpack b/bin/webpack index d2b21f9270e..8df190cf4f2 100755 --- a/bin/webpack +++ b/bin/webpack @@ -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 diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js index dee285605fb..0fa300d2c03 100644 --- a/config/webpack/configuration.js +++ b/config/webpack/configuration.js @@ -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(/\/*$/, ''); @@ -32,5 +32,6 @@ module.exports = { settings, env, output, + i18n, engines, }; diff --git a/config/webpack/shared.js b/config/webpack/shared.js index e103c6b7e9b..a5f8d32833d 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -12,7 +12,7 @@ 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'); @@ -20,7 +20,7 @@ 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', diff --git a/lib/tasks/manageiq/ui_tasks.rake b/lib/tasks/manageiq/ui_tasks.rake index 52875cce5fb..0ea4d8788c3 100644 --- a/lib/tasks/manageiq/ui_tasks.rake +++ b/lib/tasks/manageiq/ui_tasks.rake @@ -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,