Project

General

Profile

Bug #34086

Webpack can't find loaders for plugins in production

Added by Evgeni Golov 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
JavaScript stack
Target version:

Description

Ohai,

when trying to build plugin (e.g. foreman_remote_execution 5.0.0) in production, webpack fails to find the grapql-tag loader:

$ node --max_old_space_size=2048 /usr/share/foreman/node_modules/webpack/bin/webpack.js --config /usr/share/foreman/config/webpack.config.js --bail --env.pluginName=foreman_remote_execution
ModuleNotFoundError: Module not found: Error: Can't resolve 'graphql-tag/loader' in '/usr/share/foreman'
    at factoryCallback (/usr/share/foreman/node_modules/webpack/lib/Compilation.js:282:40)
    at /usr/share/foreman/node_modules/webpack/lib/NormalModuleFactory.js:237:20
    at /usr/share/foreman/node_modules/webpack/lib/NormalModuleFactory.js:60:20
    at /usr/share/foreman/node_modules/webpack/lib/NormalModuleFactory.js:193:21
    at /usr/share/foreman/node_modules/async/dist/async.js:3888:9
    at /usr/share/foreman/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/usr/share/foreman/node_modules/async/dist/async.js:1062:13)
    at /usr/share/foreman/node_modules/async/dist/async.js:969:16
    at /usr/share/foreman/node_modules/async/dist/async.js:3885:13
    at /usr/share/foreman/node_modules/async/dist/async.js:1140:9
    at /usr/share/foreman/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/usr/share/foreman/node_modules/async/dist/async.js:1062:13)
    at /usr/share/foreman/node_modules/async/dist/async.js:969:16
    at /usr/share/foreman/node_modules/async/dist/async.js:1137:13
    at /usr/share/foreman/node_modules/webpack/lib/NormalModuleFactory.js:263:20
    at onError (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:65:10)
    at loggingCallbackWrapper (/usr/share/foreman/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at runAfter (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
    at innerCallback (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
    at loggingCallbackWrapper (/usr/share/foreman/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/usr/share/foreman/node_modules/tapable/lib/Tapable.js:252:11)
    at /usr/share/foreman/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:40:4
    at loggingCallbackWrapper (/usr/share/foreman/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at runAfter (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
    at innerCallback (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
    at loggingCallbackWrapper (/usr/share/foreman/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/usr/share/foreman/node_modules/tapable/lib/Tapable.js:252:11)
    at innerCallback (/usr/share/foreman/node_modules/enhanced-resolve/lib/Resolver.js:144:11)
    at loggingCallbackWrapper (/usr/share/foreman/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/usr/share/foreman/node_modules/tapable/lib/Tapable.js:249:35)
resolve 'graphql-tag/loader' in '/usr/share/foreman'
  Parsed request is a module
  using description file: /usr/share/foreman/package.json (relative path: .)
  after using description file: /usr/share/foreman/package.json (relative path: .)
    resolve as module
      /usr/share/node_modules doesn't exist or is not a directory
      /usr/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /usr/share/foreman/node_modules
        using description file: /usr/share/foreman/package.json (relative path: ./node_modules)
        after using description file: /usr/share/foreman/package.json (relative path: ./node_modules)
          using description file: /usr/share/foreman/package.json (relative path: ./node_modules/graphql-tag/loader)
            no extension
              /usr/share/foreman/node_modules/graphql-tag/loader doesn't exist
            .js
              /usr/share/foreman/node_modules/graphql-tag/loader.js doesn't exist
            .json
              /usr/share/foreman/node_modules/graphql-tag/loader.json doesn't exist
            as directory
              /usr/share/foreman/node_modules/graphql-tag/loader doesn't exist

This prevents building plugins that need loaders for Debian.
This is not a problem for RPM builds, as there we force all NPM modules to be in the top-level /usr/share/foreman/node_modules.
This is not a problem in dev builds, because probably something is different between prod and dev :shrug:

Associated revisions

Revision 4f0ced0e (diff)
Added by Evgeni Golov 8 months ago

Fixes #34086 - explicitly depend on graphql-tag

We configure the graphql-tag loader in webpack, but didn't depend on it
in the past, which made builds using the loader (like REX plugin) fail.

Also adding `graphql` itself, as this is needed by the loader when
building stuff.

History

#1 Updated by The Foreman Bot 8 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8968 added

#2 Updated by The Foreman Bot 8 months ago

  • Pull request https://github.com/theforeman/foreman/pull/8975 added

#3 Updated by The Foreman Bot 8 months ago

  • Fixed in Releases 3.2.0 added

#4 Updated by The Foreman Bot 8 months ago

  • Pull request https://github.com/theforeman/foreman/pull/8981 added

#5 Updated by Evgeni Golov 8 months ago

  • Target version set to 3.1.0

#6 Updated by Evgeni Golov 8 months ago

  • Status changed from Ready For Testing to Closed

#7 Updated by The Foreman Bot 8 months ago

  • Fixed in Releases 3.1.1 added

#8 Updated by Evgeni Golov 8 months ago

  • Fixed in Releases 3.1.0 added
  • Fixed in Releases deleted (3.1.1, 3.2.0)

#9 Updated by Amit Upadhye 8 months ago

  • Subject changed from webpack can't find loaders for plugins in production to Webpack can't find loaders for plugins in production

Also available in: Atom PDF