Actions
Bug #34086
closedWebpack can't find loaders for plugins in production
Difficulty:
Triaged:
No
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:
Updated by The Foreman Bot about 3 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/8968 added
Updated by The Foreman Bot about 3 years ago
- Pull request https://github.com/theforeman/foreman/pull/8975 added
Updated by The Foreman Bot about 3 years ago
- Pull request https://github.com/theforeman/foreman/pull/8981 added
Updated by Evgeni Golov about 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|4f0ced0e7966a416f02aedc2f46e2a8a36ea9236.
Updated by Evgeni Golov about 3 years ago
- Fixed in Releases 3.1.0 added
- Fixed in Releases deleted (
3.1.1, 3.2.0)
Updated by Amit Upadhye about 3 years ago
- Subject changed from webpack can't find loaders for plugins in production to Webpack can't find loaders for plugins in production
Actions