-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Add "Did you mean '--entry index.js'?" #2356
Comments
As I mentioned in #2322 (comment) , It was difficult to differentiate between an invalid command and an entry point. |
But I think we can do something like follow - for if (isFileExists('invalid')) {
logger.error('Did you mean '--entry index.js'?')
} else {
// current behaviour
} |
hm, maybe we can do, I will think about it |
I am WIP on old syntax (will be in the next patch release) -
|
We return: |
I had code that depended on |
Sorry to be clear, i'd want to set a different name like: |
Another strange thing, is that providing multiple entry points always sets the |
|
Well in the meantime, if anybody runs into this issue, you can try something along the lines of: class CompilerHooks {
apply(compiler) {
// Rewrite the "main" entry point
compiler.hooks.entryOption.tap('Entry Rewrite', (context, entry) => {
// Delete the main entry point and get the entry files
const entryFiles = entry.main.import
delete entry.main
// Add new entry points for each file
for ( let fileName of entryFiles ) {
const name = path.parse(fileName).name
entry[name] = { import: [fileName] } }
})
}
} Then in your config: config = {
plugins: [new CompilerHooks()]
...
} You can even add in some environment variables if you want to make this more elaborate 😄 |
If you need |
Is your feature request related to a problem? Please describe.
The simplest usage stopped working in v4 and the error is meaningless
Describe the solution you'd like
Tell me how to fix it rather than having to Google my way out of cryptic error messages.
❯ webpack index.js [webpack-cli] Unknown command 'index.js' + [webpack-cli] Did you mean '--entry index.js'? [webpack-cli] Run 'webpack --help' to see available commands and options
Additional context
People having issues:
The text was updated successfully, but these errors were encountered: