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

@betterer/angular not working with angular 14/15 project #1134

Open
daddingtontm opened this issue Mar 27, 2023 · 1 comment
Open

@betterer/angular not working with angular 14/15 project #1134

daddingtontm opened this issue Mar 27, 2023 · 1 comment

Comments

@daddingtontm
Copy link

daddingtontm commented Mar 27, 2023

Describe the bug
I'm trying to use the @betterer/angular package to incrementally introduce strict templates into our application. It seems that way the package is doing imports is incompatible with use within an angular application and so I'm getting the following error. I've noticed that the @betterer/angular package uses Angular 12 so I'm assuming it has broken since introduced in that version?

Error:require() of ES Module
      /Users/daddington/personal/ng-15-app/node_modules/@angular/compiler-cli/bundles/index.js from
      /Users/daddington/personal/ng-15-app/node_modules/@betterer/angular/dist/angular.js not supported.
      Instead change the require of index.js in
      /Users/daddington/personal/ng-15-app/node_modules/@betterer/angular/dist/angular.js to a dynamic import()
       which is available in all CommonJS modules.
  Instead change the require of index.js in
  /Users/daddington/personal/ng-15-app/node_modules/@betterer/angular/dist/angular.js to a dynamic import()
  which is available in all CommonJS modules.
      at require.extensions.<computed> [as .js] (/Users/daddington/personal/ng-15-app/node_modules/@betterer/be
  tterer/node_modules/ts-node/dist/index.js:851:20)
      at Object.<anonymous>
  (/Users/daddington/personal/ng-15-app/node_modules/@betterer/angular/dist/angular.js:4:24)
      at require.extensions.<computed> [as .js] (/Users/daddington/personal/ng-15-app/node_modules/@betterer/be
  tterer/node_modules/ts-node/dist/index.js:851:20)
      at Object.<anonymous>
  (/Users/daddington/personal/ng-15-app/node_modules/@betterer/angular/dist/index.js:9:17)
      at require.extensions.<computed> [as .js] (/Users/daddington/personal/ng-15-app/node_modules/@betterer/be
  tterer/node_modules/ts-node/dist/index.js:851:20)
      at Object.<anonymous> (/Users/daddington/personal/ng-15-app/.betterer.ts:3:19)
      at m._compile (/Users/daddington/personal/ng-15-app/node_modules/@betterer/betterer/node_modules/ts-node/
  dist/index.js:857:29)
      at require.extensions.<computed> [as .ts] (/Users/daddington/personal/ng-15-app/node_modules/@betterer/be
  tterer/node_modules/ts-node/dist/index.js:859:16)
      at requireUncached
  (/Users/daddington/personal/ng-15-app/node_modules/@betterer/betterer/dist/require.js:7:15)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce

  • Add check to an Angular 14 or 15 application as per documentation
  'stricter template compilation': () =>
        angular('./tsconfig.json', {
          strictTemplates: true
        })
        .include('./src/**/*.ts', './src/**/*.html'),

Minimum repo here - https://github.com/kiwiaddo/ng-15-app

Expected behavior

  • I would expect to be able to run the angular betterer rule for any modern angular 14 or 15 application

Versions (please complete the following information):

  • OS: macOS 13.2.1
  • Betterer Version: 5.4.0
  • Node Version: 18.13.0
@michealharrington
Copy link

This is a duplicate of #936

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

2 participants