Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: add warning if no function files found #84

Merged
merged 1 commit into from
Dec 17, 2018
Merged

Conversation

swyxio
Copy link
Contributor

@swyxio swyxio commented Dec 3, 2018

this PR makes the console output a bit more helpful when you dont have a valid file in your functions folder, e.g you have nested a folder like functions/hello/hello.js instead of functions/hello.js.

this mistake will cause a cryptic warning like:

/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/node_modules/webpack/lib/webpack.js:31
                throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
                ^

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.entry should be one of these:
   function | object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-emptystring]
   -> The entry point(s) of the compilation.
   Details:
    * configuration.entry should be an instance of function
      -> A Function returning an entry object, an entry string, an entry array or a promise to these things.
    * configuration.entry should not be empty.
      -> Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
    * configuration.entry should be a string.
      -> An entry point without name. The string is resolved to a module which is loaded upon startup.
    * configuration.entry should be an array:
      [non-empty string]
    at webpack (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/node_modules/webpack/lib/webpack.js:31:9)
    at Object.exports.watch (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/lib/build.js:117:18)
    at Command.<anonymous> (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/bin/cmd.js:31:11)
    at Command.listener (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:182:13)
    at Command.parseArgs (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/node_modules/commander/index.js:654:12)
    at Command.parse (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/node_modules/commander/index.js:474:21)
    at Object.<anonymous> (/Users/swyx/Work/hooks-suspense-faunadb-todo/node_modules/netlify-lambda/bin/cmd.js:61:9)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
error Command failed with exit code 1.

just trying to make the DX a bit better here by hinting at what's wrong.

what do folks think?

add warning if no function files found
@8eecf0d2
Copy link
Contributor

Personally find Webpack validation error's helpful enough but still a worthwhile change

@swyxio
Copy link
Contributor Author

swyxio commented Dec 17, 2018

sweet

@swyxio swyxio merged commit 714ace4 into master Dec 17, 2018
@erezrokah erezrokah deleted the sw-yx-patch-1 branch January 14, 2021 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants