Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any support for webpack-4 or webpack-5 #125

Open
Elia-Sh opened this issue May 27, 2020 · 8 comments
Open

any support for webpack-4 or webpack-5 #125

Elia-Sh opened this issue May 27, 2020 · 8 comments

Comments

@Elia-Sh
Copy link

Elia-Sh commented May 27, 2020

I've been trying to utilize the loader for the pug+webpack boilerplate,
but had problems to do so, even after extensive reading of
https://webpack.js.org/loaders/
and all documentation provided by pugjs/pug-loader.

there are bi-directional redirections of the help sections from pug-loader to webpack/loaders,
I find the examples under the documentation sections - partial at best,

There are nice articles how to "tie-in" all the pieces together,
for example: https://extri.co/2017/05/23/using-htmlwebpackplugin-and-pug/
and https://itnext.io/webpack-4-write-pug-templates-c24e5ea07317,
and the nice github-issue - #97

Looks like webpack is the de facto standard of the current candlers and I suspect that providing official full covering documentation may be very beneficial for on-boarding pug and webpack newcomers.

@mrmowgli
Copy link

?Were you able to get this working correctly? Even with Webpack-5?

@perry-mitchell
Copy link

Working fine for me on Webpack 5, Node 14..

@simabui
Copy link

simabui commented Feb 11, 2021

@perry-mitchell how did you resolve img path in pug?
I am receiving 404 Not Found, but with webpack 4.44 it worked fine for me

index.js
import "../images/me.jpg";

webpack.config.js
{ test: /\.pug$/, use: [ { loader: "pug-loader", options: { pretty: true, }, }, ], },

@BassOfBass
Copy link

@perry-mitchell
What paths are you talking about? For paths inside templates you have to use require(path) and whatever you import into .js file is not covered by pug.

@webdiscus
Copy link

try this one https://github.com/Spence-S/simple-pug-loader - alive and has regular updates
plus we have a little hope that pug-loader will become a part of webpack's core infrastructure - #124 (as @sokra sad)

Sorry, but simple-pug-loader not resolve Webpack Aliases. It doesn't work for me, e.g.:

include ~Templates/page.pug
p  Hello world!

where Templates is defined by webpack config resolve.alias: { Templates: '/path/to/templates/' }

Here is alternative pug-loader, 100% compatible with original pugs/pug-loader, but work with Webpack 5 and Pug 3 , support webpack aliases and is many time faster.

@Rush
Copy link

Rush commented Nov 23, 2021

well interesting... ping guys with your version at the (#124 thread) pls.

I just did because after recent fixes by @webdiscus, @webdiscus/pug-loader is now in very good shape. It even has support for html rendering mode which replaces pug-html-loader.

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

No branches or pull requests

8 participants
@Rush @mrmowgli @perry-mitchell @Elia-Sh @webdiscus @simabui @BassOfBass and others