danguilherme / ng-cli-pug-loader

:sparkles: Angular schematics to add .pug to your project
GNU General Public License v3.0
56 stars 17 forks source link

Angular 11 updated common.js and typescript.js locations #37

Closed jmbarbier closed 10 months ago

jmbarbier commented 3 years ago

I've not enough time now for a PR, but for angular 11, common.js is now node_modules/@angular-devkit/build-angular/src/webpack/configs/common.js and typescript.js is now at node_modules/@angular-devkit/build-angular/src/webpack/configs/typescript.js

so in ng-add-pug-loader.js, we have to update :

const commonCliConfig = 'node_modules/@angular-devkit/build-angular/src/webpack/configs/common.js';

const typescriptCliConfig = 'node_modules/@angular-devkit/build-angular/src/webpack/configs/typescript.js';
ChickenRunVN commented 3 years ago

Great discovery, I have to detect the error and update manually after ng update throws a lot of errors. Also, I notice that the console no longer throw any error when check and compile with pug after update to Angular 11 (in version 10 I got tons of those)

netmiller commented 3 years ago

I tried those two updates @jmbarbier mentioned, but still got errors 👍

Error: Module parse failed: Unexpected character '#' (2:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
> #ad-main
|
|     #ad-header

I have upgraded my project from Angular 10 -> v.11. Any idea what I have forgotten ?

ChickenRunVN commented 3 years ago

I tried those two updates @jmbarbier mentioned, but still got errors 👍

Error: Module parse failed: Unexpected character '#' (2:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
> #ad-main
|
|     #ad-header

I have upgraded my project from Angular 10 -> v.11. Any idea what I have forgotten ?

You can try: Method 1: After update ng-add-pug-loader.js as @jmbarbier mentioned above, run npm install again. The postinstall script in your package.json will be executed and it will update the common.js and typescript.js. Method 2:

diogoterremoto commented 3 years ago

Upgraded from 10 to 11. Although the common.js and typescript.js are correctly set, I still got the following error:

zone-evergreen.js:659
Unhandled Promise rejection: Errors during JIT compilation of template for AnalyticsOverlayBlockComponent:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)

Any ideas?

ChickenRunVN commented 3 years ago

Upgraded from 10 to 11. Although the common.js and typescript.js are correctly set, I still got the following error:

zone-evergreen.js:659
Unhandled Promise rejection: Errors during JIT compilation of template for AnalyticsOverlayBlockComponent:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)

Any ideas?

I think you need to update your angular.json which may help solve the problem. Example configuration:

  "projects": {
    "my-project": {
      "architect": {
        "build": {
          "options": {
            "aot": false
          }
        },
        "configurations": {
          "production": {
            "aot": true
          }
        }
      }
    }
  }
}

For more details, please take a look at #31

diogoterremoto commented 3 years ago

Thank you for your support.

The whole page is now blank: the <app> element has no children. I was using @angular-builders/custom-webpack builder, but this also happens with the default @angular-devkit/build-angular.

This only happens when the default builder is upgraded to 0.1100.0.

H--o-l commented 3 years ago

For info since Angular v11.1.0, the option directTemplateLoading that needs to be set to false, is now inside the file node_modules/@ngtools/webpack/src/ivy/plugin.js It was changed by commit https://github.com/angular/angular-cli/commit/4e168b81c5de6c4ae91e29a40bdf0e0c98910fb4

Rush commented 3 years ago

@H--o-l but that seems to be an option for AngularWebpackPlugin which apparently is not the same as AngularCompilerPlugin. Unless they already exposed AngularWebpackPlugin ?

H--o-l commented 3 years ago

@Rush I can't answer sorry. All I know is that it fixes the issue for me for Angular 11.

danguilherme commented 10 months ago

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