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

Loading wrong file on file changes #2

Closed Rush closed 2 years ago

Rush commented 2 years ago

First time build seems to run fine, but on file changes a wrong file seems to be recompiled giving me cryptic angular errors

ERROR in src/app/components/manage-page.component.pug:1:4603 - error TS2339: Property 'editorLimit' does not exist on type 'ManagePageComponent'.

1 <div class="editor" #editorDiv [class.full]="hideUI" [class.has-bottom]="showSequence" preventTouch><editor-view [class.ha

and then the code shown actually concerns a different file altogether.

webdiscus commented 2 years ago

First time build seems to run fine, but on file changes a wrong file seems to be recompiled giving me cryptic angular errors

ERROR in src/app/components/manage-page.component.pug:1:4603 - error TS2339: Property 'editorLimit' does not exist on type 'ManagePageComponent'.

1 <div class="editor" #editorDiv [class.full]="hideUI" [class.has-bottom]="showSequence" preventTouch><editor-view [class.ha

and then the code shown actually concerns a different file altogether.

Can you please show the code snippet with issue in pug file? Before analyzing the error, I must be able to reproduce it.

webdiscus commented 2 years ago

First time build seems to run fine, but on file changes a wrong file seems to be recompiled giving me cryptic angular errors

ERROR in src/app/components/manage-page.component.pug:1:4603 - error TS2339: Property 'editorLimit' does not exist on type 'ManagePageComponent'.

1 <div class="editor" #editorDiv [class.full]="hideUI" [class.has-bottom]="showSequence" preventTouch><editor-view [class.ha

and then the code shown actually concerns a different file altogether.

Exact the error TS2339 can I reproduce local if in template is used a angular variable not defined (or private ) property/method in a Component Class.

For example:

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  styleUrls: ['./app.component.css'],
  templateUrl: './app.component.pug',
})
export class AppComponent {
  myCssClass = 'my-css-class';
}

app.component.pug

#myDiv([class]="myCssClass") some text...

This work, but if to delete the property myCssClass in the class AppComponent then appear this error TS2339.

Perhaps, you should check whether the property editorLimit exists in the class ManagePageComponent. Without a code snippet I can't reproduce your problem.

Rush commented 2 years ago

Issue no longer happening with the latest version and with the html mode.