Expected Behaviour
When missing a dependency needed to bundle up an action, a clear error will inform a user that they're missing a dependency when running aio app deploy
Actual Behaviour
Missing dependencies (in my case, a peer dependency, but will happen with any missing dep) leads to errors that aren't straight-forward for those not intimately familiar with webpack and npm:
> Build actions
✖ Build actions
Error: action build failed, webpack compilation errors:
./node_modules/graphql-tag/lib/graphql-tag.umd.js
Module not found: Error: Can't resolve 'graphql/language/parser' in '/Users/andrewlevine/aio-test/node_modules/graphql-tag/lib'
resolve 'graphql/language/parser' in '/Users/andrewlevine/aio-test/node_modules/graphql-tag/lib'
Parsed request is a module
using description file: /Users/andrewlevine/aio-test/node_modules/graphql-tag/package.json (relative path: ./lib)
resolve as module
/Users/andrewlevine/aio-test/node_modules/graphql-tag/lib/node_modules doesn't exist or is not a directory
/Users/andrewlevine/aio-test/node_modules/graphql-tag/node_modules doesn't exist or is not a directory
/Users/andrewlevine/aio-test/node_modules/node_modules doesn't exist or is not a directory
/Users/andrewlevine/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/andrewlevine/aio-test/node_modules
using description file: /Users/andrewlevine/aio-test/package.json (relative path: ./node_modules)
using description file: /Users/andrewlevine/aio-test/package.json (relative path: ./node_modules/graphql/language/parser)
no extension
/Users/andrewlevine/aio-test/node_modules/graphql/language/parser doesn't exist
.js
/Users/andrewlevine/aio-test/node_modules/graphql/language/parser.js doesn't exist
as directory
/Users/andrewlevine/aio-test/node_modules/graphql/language/parser doesn't exist
[/Users/andrewlevine/aio-test/node_modules/graphql-tag/lib/node_modules]
[/Users/andrewlevine/aio-test/node_modules/graphql-tag/node_modules]
[/Users/andrewlevine/aio-test/node_modules/node_modules]
[/Users/andrewlevine/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/andrewlevine/aio-test/node_modules/graphql/language/parser]
[/Users/andrewlevine/aio-test/node_modules/graphql/language/parser.js]
@ ./node_modules/graphql-tag/lib/graphql-tag.umd.js 7:13-47
@ ./actions/graphql/index.js
@ multi ./actions/graphql/index.js
at compiler.run (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-app-scripts/scripts/build.actions.js:98:41)
at finalCallback (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:257:39)
at hooks.done.callAsync.err (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:273:13)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/andrewlevine/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/Hook.js:154:20)
at onCompiled (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:271:21)
at hooks.afterCompile.callAsync.err (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:681:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/andrewlevine/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/Hook.js:154:20)
at compilation.seal.err (~/.nvm/versions/node/v10.16.2/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:678:31)
Because this is a node-based application, I think developers will expect to see the typical "module not found" message you'd get from node without bundling.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
- Create a new I/O Application with an action
- Run
npm install graphql-tag, and require('graphql-tag') in an action
- Run
aio app deploy
Notes
npm version 7 plans to auto-install peerDependencies (again), which would make this less of an issue for peerDependencies, but still a problem for direct dependencies.
Platform and Version
Sample Code that illustrates the problem
Logs taken while reproducing problem
Expected Behaviour
When missing a dependency needed to bundle up an action, a clear error will inform a user that they're missing a dependency when running
aio app deployActual Behaviour
Missing dependencies (in my case, a peer dependency, but will happen with any missing dep) leads to errors that aren't straight-forward for those not intimately familiar with webpack and npm:
Because this is a node-based application, I think developers will expect to see the typical "module not found" message you'd get from node without bundling.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
npm install graphql-tag, andrequire('graphql-tag')in an actionaio app deployNotes
npmversion 7 plans to auto-install peerDependencies (again), which would make this less of an issue forpeerDependencies, but still a problem for direct dependencies.Platform and Version
Sample Code that illustrates the problem
Logs taken while reproducing problem