Giter VIP home page Giter VIP logo

Comments (9)

webdiscus avatar webdiscus commented on August 26, 2024 1

@m10 Thanks for explaining the problem. This helps me to start researching the problem.

from pug-loader.

webdiscus avatar webdiscus commented on August 26, 2024

Hello @XenoBino,

thank You for the report.

  1. I need to see your webpack.config.js and pug template.
  2. Are you using the self option of the pug loader? Is it enabled?
  3. Does the error occur in build mode: webpack --mode=production, not with serv?

Seems this is Pug compiler error, not pug-loader.
Something is in your Pug template wrong.

from pug-loader.

m10 avatar m10 commented on August 26, 2024

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.

spence-s/simple-pug-loader#10

from pug-loader.

m10 avatar m10 commented on August 26, 2024

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..

if (error.filename) loaderContext.addDependency(path.normalize(error.filename));

from pug-loader.

webdiscus avatar webdiscus commented on August 26, 2024

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..

if (error.filename) loaderContext.addDependency(path.normalize(error.filename));

Could you please show your short snippets of Pug:

  • the snippet works correctly
  • the same snippet contained a Pug error that is causing this issue

from pug-loader.

webdiscus avatar webdiscus commented on August 26, 2024

@m10 @XenoBino
I can reproduce the error Error parsing body of the with expression with following invalid code:

- const str = /.+/$

Reproduce

We need two Pug files:

  1. index.pug
h1 Index
include dependency
  1. dependency.pug
h1 Dependency

//- This line is invalid and generates an error
- const str = /.+/$

When an invalid code is in included dependency.pug file then appear not recoverable error and webpack must be restarted.

from pug-loader.

webdiscus avatar webdiscus commented on August 26, 2024

@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?

from pug-loader.

m10 avatar m10 commented on August 26, 2024

@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?

from pug-loader.

webdiscus avatar webdiscus commented on August 26, 2024

@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.

from pug-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.