-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Improve importMeta message -meow - The 'importMeta' option is required. Its value must be 'import.meta' at meow
#222
Comments
meow - The
importMeta option is required. Its value must be
import.meta`at meowmeow - The 'importMeta' option is required. Its value must be 'import.meta' at meow
I know :(((( Forgive me |
I believe the error message is clear enough. You should read our documentation and examples before use. |
nice u must be fun at parties |
lol. Do you mean we didn't explain in the documentation why we mark this parameter as required? Hmmm, maybe you are right. Feel free to reopen it if you would like to discuss further. |
Coming here to thank you OP for posting this! I had the same issue. 😅 It wasn't immediately clear to me in the example from the documentation that the I also misunderstood the error message. I thought "TypeError: The `importMeta` option is required. Its value must be `import.meta`." meant I had to do something like: { importMeta: 'some-magic-meta-data-for-my-module-maybe-the-file-path-or-something' } or maybe something more literal like: { importMeta: `import.meta` } I believe I misread the documentation because the first example is a little long and the required options got buried by the rest of the example. Maybe something like this would be more obvious? #!/usr/bin/env node
import meow from 'meow';
import foo from './lib/index.js';
const cli = meow(`text to display for the --help option`,
{
importMeta: import.meta, // required
flags: {
rainbow: {
type: 'boolean',
shortFlag: 'r'
}
}
});
/*
{
input: ['unicorns'],
flags: {rainbow: true},
...
}
*/
foo(cli.input.at(0), cli.flags); and then later on give a longer example where your users can describe the usage in more details? 🙂 🙏🏼 |
@chuyaguo2014 you should open a new issue suggesting more documentation. I like adding the |
I apologize if this is clear for most people, but I've dealt with a lot of headaches with node
--experimental-modules
.My Experience
When I imported
meow
, with:import meow from 'meow';
And did
const cli = meow();
,This is what I saw:
I was convinced that it was something to do with the ES module stuff and it took me down the wrong path for hours.
The Solution
It wasn't until I went to the docs and searched specifically for the
importMeta
; (😮💨 definitely should have done that soon 🤦)Proposal
BOOST the error message on GoogleThus, I decided to open an issue in case anyone else searches for the same issue.Maybe provider a clearer message?
I don't know enough about
meow
to offer a better message.The text was updated successfully, but these errors were encountered: