ng-cli-pug-loader icon indicating copy to clipboard operation
ng-cli-pug-loader copied to clipboard

After Angular 8 Update, Pug renders text only

Open jasonspick opened this issue 5 years ago • 9 comments

Now that the struggle of the Angular 8 update is over. None of my pug files are compiling. Or they are.... to plain text. Angular 8.1.0 "ng-cli-pug-loader": "^0.2.0", "pug": "^2.0.4", "pug-loader": "^2.4.0",

Did you have yo do anything different after update?

jasonspick avatar Jul 06 '19 13:07 jasonspick

Maybe run npm run postinstall again after update?

It will run ng-add-pug-loader.js that modify the webpack config file inside angular module.

hwupu avatar Jul 16 '19 17:07 hwupu

Before trying the npm run postinstall solution you should delete the node_modules folder.

Try this, inside your project folder: rm -rf node_modules && npm install (postinstall will run automatically).

danguilherme avatar Jul 17 '19 08:07 danguilherme

I'm having this issue also... already tried rm -rf node_modules && npm install and npm run postinstall and none worked... Is there any option besides going back to plain html? Did anyone make it run in Angular 8.2.0? I just updated angular version and my whole project crashed...

Angular 8.2.0 "ng-cli-pug-loader": "^0.2.0", "pug": "^2.0.4", "pug-loader": "^2.4.0",

rHilkner avatar Aug 06 '19 19:08 rHilkner

Has anyone had any luck with this? I have it working with .pug files, but it doesn't work inside the template: `` string for a single file component

jcjolley avatar Oct 21 '19 20:10 jcjolley

I didn't take a deeper look in this problem, sorry. Also not planning to do that really soon...

danguilherme avatar Oct 21 '19 23:10 danguilherme

My only solution was to downgrade Angular and keep using Angular 7.

rHilkner avatar Oct 21 '19 23:10 rHilkner

Our setup is a bit different and might be interesting for anyone having issues. I upgraded form Angular 7 to 8 and just got it working.

  1. We pre compile index.pug before serving the project (angular.json points to a HTML file)
  2. Uninstall ng-cli-pug-loader, remove ng-add-pug-loader.js
  3. Install ng-cli-pug-loader
  4. Remove node_modules and run clean npm install

perrosen avatar Dec 02 '19 00:12 perrosen

What do you mean by "Install ng-cli-pug-loader"? npm install ng-cli-pug-loader or ng add ng-cli-pug-loader?

danguilherme avatar Dec 03 '19 10:12 danguilherme

Yes, basically the problem is with the old ng-add-pug-loader.js that your project may have in the root. Removing the file and reinstalling ng-cli-pug-loader, updates the file with proper contents.

undsoft avatar Feb 06 '20 09:02 undsoft

This project is no longer maintained. Check out ngx-pug-builders to add support to pug files to your Angular project.

danguilherme avatar Nov 21 '23 23:11 danguilherme