webdiscus / pug-loader

Pug loader for Webpack renders pug to HTML or template function
https://webdiscus.github.io/pug-loader/pug-filters
ISC License
72 stars 5 forks source link

Missing peer dependency pug-walk #19

Closed m10 closed 2 years ago

m10 commented 2 years ago

The loader uses the pug-walk module [1] but there is no corresponding entry in the package.json.

pug-walk should be added to the peerDependencies.

Also I noticed webpack-merge being a dependency. Probably this should just be a dev dependency?

[1] https://github.com/webdiscus/pug-loader/blob/18f7e19059bbdb928a24b3bd49fab1c3f6189fdf/src/index.js#L7

webdiscus commented 2 years ago

@m10

1. In legacy pug version <= 2.x was pug-walk as external module. In pugjs/pug >=v3.02 is the pug-walk already included in the packages. In peerDependencies is already "pug": ">=3.0.2", therefore is not need to define pug-walk to peerDependencies.

2. The webpack-merge used in self Pug loader for merging deep nested objects, therefore must be in the dependency.

m10 commented 2 years ago

1. You are right that it is a dependency of dependencies of pug. Still IMO it should be a peer dependency since you use that module directly and not just pug, the dependencies of pug could theoretically change...

  1. Well, I should have checked how it's used :P

(originally i filed this issue because of webpack complaining about missing pug-walk module, but there must have been something wrong with my node_modules since i can't reproduce anymore and does not make sense)

webdiscus commented 2 years ago

An npm warning like ...missing pug-walk module ... is displayed if old Pug <= 2.x.x is used. Sometimes the package-lock.json contains not actual info about all packages, then helps the deleting package-lock.json with node_modules and new install.

Since Pug 3, all pug- dependencies have been included to monolithic Pug. I have research this question and I know 100% that all pug- packages like pug-walk and others are the parts of Pug self. If this changes in future versions of Pug, I will fix it. I see no reason to use something that is not required at the moment. ;-)