Comments (9)
@m10 Thanks for explaining the problem. This helps me to start researching the problem.
from pug-loader.
Hello @XenoBino,
thank You for the report.
- I need to see your webpack.config.js and pug template.
- Are you using the
self
option of the pug loader? Is it enabled? - 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.
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.
from pug-loader.
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..
Line 167 in b430032
from pug-loader.
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..
Line 167 in b430032
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.
@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:
index.pug
h1 Index
include dependency
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.
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.
@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 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)
- Failed to build when webpack alias for asset is an array of paths instead of a single path HOT 5
- [CRITICAL] [SECURITY] Pug variables leak between different executions of rendered templates HOT 10
- Path errors on Windows? HOT 6
- How to use it with tailwindcss and server side rendering? HOT 13
- Support resolving modules HOT 1
- Compile error on bad JS Syntax is confusing HOT 3
- Support Webpack defined modules HOT 4
- Missing peer dependency pug-walk HOT 3
- Cannot read properties of undefined (reading 'sync') in @webdiscus\pug-loader\src\Resolver.js HOT 2
- Vue production build errors in example HOT 6
- hello-world-app does not compile HOT 3
- webpack-dev-server: pages require access with .html HOT 7
- Doesn't fix indent pug with @webdiscus/pug-loader on nuxt 3 (vite) HOT 3
- Will this support pug3? HOT 2
- Improve the error message to find where the error occurred HOT 2
- `include` doesn't use dynamic `resolve.alias` (from tsconfig-paths-webpack-plugin) HOT 11
- img srcset attribute HOT 3
- htmlWebpackPlugin.options not available in pug template HOT 10
- Errors don't show the exact location of the error HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pug-loader.