Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

No errors when webpack config fails #71

Open
ThaNarie opened this issue Jun 22, 2018 · 2 comments
Open

No errors when webpack config fails #71

ThaNarie opened this issue Jun 22, 2018 · 2 comments

Comments

@ThaNarie
Copy link

When your webpack config is invalid, it won't output to the console because quiet is true, but the plugin has not been 'applied'.

Error with quiet set to to false:

$ cross-env NODE_ENV=development webpack-dev-server --inline --progress --config build-tools/config/webpack/webpack.dev.conf.js
✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.filename: A relative path is expected. However the provided value "/asset/[name].js" is an absolute path!
   -> Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
   Please use output.path to specify absolute path and output.filename for the file name.
error Command failed with exit code 1.

Error with quiet set to true:

$ cross-env NODE_ENV=development webpack-dev-server --inline --progress --config build-tools/config/webpack/webpack.dev.conf.js
error Command failed with exit code 1.

Adding a log in the constructor and in the apply(compiler) { methods, only the constructor is executed.

So it seems there is a 'gap' before the plugin kicks in, where errors could happen, but don't get outputted because quiet needs to be set to true for this plugin to 'work'.

I'm not sure if there is a way to fix this, otherwise it would be good to clearly mention it in the readme/docs; when webpack exits without an error, temporarily disable the quiet mode.

@pk-nb
Copy link
Contributor

pk-nb commented Jul 17, 2018

I believe this will be fixed with #66 as that change will watch on the "failed" hook. This means webpack failures will be caught in addition to the compilation errors.

@ThaNarie
Copy link
Author

Unfortunately I think that will not be the case :(

Adding a log in the constructor and in the apply(compiler) methods, only the constructor is executed.

The "failed" hook is added in the apply method, which is never executed in the described case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants