Closed XenoBino closed 2 years ago
Hello @XenoBino,
thank You for the report.
self
option of the pug loader? Is it enabled?webpack --mode=production
, not with serv?Seems this is Pug compiler error, not pug-loader. Something is in your Pug template wrong.
i get that error too when there is e.g. a syntax error in a javascript snippet in the pug template. I agree that the error message is most unhelpful.
the overall problem with error handling ("requires restart") seems to be that the loader / pug can't resolve the dependencies anymore and thus webpack does not watch the files anymore. Only the entrypoint is still being watched, saving that one will trigger a rebuild. One has to know that though.
Other loaders have / had this problem too. E.g. simlpe-pug-loader adds at least the file where the error happened, even if not ideal it does help. A mechanism to remember the dependencies and keep watching them on error would be ideal though.
@m10 Thanks for explaining the problem. This helps me to start researching the problem.
I checked the source and @webdiscus/pug-loader does in fact add the error file as dependency. For some reason this does not seem to work for this kind of error. Maybe pug does not return any filename in this case..
I checked the source and @webdiscus/pug-loader does in fact add the error file as dependency. For some reason this does not seem to work for this kind of error. Maybe pug does not return any filename in this case..
Could you please show your short snippets of Pug:
@m10 @XenoBino
I can reproduce the error Error parsing body of the with expression
with following invalid code:
- const str = /.+/$
We need two Pug files:
index.pug
h1 Index
include dependency
dependency.pug
h1 Dependency
//- This line is invalid and generates an error
When an invalid code is in included dependency.pug
file then appear not recoverable error and webpack must be restarted.
@XenoBino @m10
the issue is fixed in version 2.2.1
.
Do you can please test it and give a feedback whether the problem is solved?
@webdiscus i can confirm that the newest version 2.3.0
recovers correctly from JS syntax errors.
The error message ist still confusing though. Should that be tracked in a separate issue?
@webdiscus i can confirm that the newest version
2.3.0
recovers correctly from JS syntax errors.The error message ist still confusing though. Should that be tracked in a separate issue?
Yes, please new issue/enhancement create in a separate issue, inc. your error message completely.
I am facing a non reproducible issue where:
Doesn't go even if I comment the whole file. It requires me to restart the webpack dev server instance. My build is CPU intensive. It takes about half a minute to have something on the screen and caching is not working properly. I have to wait half a minute every time a pug error occurs. And pug errors are extremely unreadable. Making it even harder to fix the pug error.