Bug #20511

Webpack config should look for nested node_modules

Added by Daniel Lobato Garcia 6 months ago. Updated 4 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Plugins-Engines
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4719
Story points-
Velocity based estimate-
Release1.16.0Release relationshipAuto

Description

The current value of resolve.modules in config/webpack.config.js is "path.join....'node_modules')".
This value doesn't work when dependencies have been installed using global style (npm install --global-style true).

In this style, which is what foreman-packaging uses, dependencies of dependencies get nested like:

node_modules/dependencyA/node_modules/dependencyB

in a tree like structure. foreman-packaging needs to install in this mode because the npm cache is stored
like a tree.

The solution I've been given in #webpack is to use a string 'node_modules' instead of path.join. The reason is that
webpack purposefully looks for nested dependencies in that case, but not if you provide the full path.

Associated revisions

Revision 8822b551
Added by Daniel Lobato Garcia 6 months ago

Fixes #20511 - Webpack config should look for nested deps

The current value of resolve.modules in config/webpack.config.js is
"path.join....'node_modules'"".
This value doesn't work when dependencies have been installed using
global style (npm install --global-style true).

In this style, which is what foreman-packaging uses, dependencies of
dependencies get nested like:

node_modules/dependencyA/node_modules/dependencyB

in a tree like structure. foreman-packaging needs to install in this
mode because the npm cache is stored
like a tree.

The solution I've been given in #webpack is to use a string
'node_modules' instead of path.join. The reason is that
webpack purposefully looks for nested dependencies in that case, but not
if you provide the full path.

History

#1 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4719 added

#2 Updated by Daniel Lobato Garcia 6 months ago

  • Release set to 1.16.0

#3 Updated by Anonymous 6 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Daniel Lobato Garcia 4 months ago

  • Category set to Plugins-Engines

Also available in: Atom PDF