0

I recently upgraded ngx-mask to version 16.2.6, and after the upgrade, I'm facing an issue where the Angular compiler can't find NgxMaskModule exported from 'ngx-mask'.

The error message I'm receiving is:

ERROR in ./src/.....ts:2:10
TS2305: Module '"ngx-mask"' has no exported member 'NgxMaskModule'.

Here's how I'm importing NgxMaskModule in my Angular module:

import { NgxMaskModule } from 'ngx-mask';

I've checked the documentation and other resources, but couldn't find any breaking changes related to this.

Has anyone else faced this issue after upgrading? Is there a new way to import NgxMaskModule or have there been any changes in the recent versions of ngx-mask that I might have missed?

Sumit Arora
  • 5,051
  • 7
  • 37
  • 57

1 Answers1

1

Since you are migrating the ngx-mask library to the version greater than 15.0.0, you need to do some migration in importing the provider according to the documentation (Quickstart if ngx-mask version >= 15.0.0 section)

Import ngx-mask directive, pipe and provide NgxMask providers with provideNgxMask function.

import { NgxMaskDirective, NgxMaskPipe, provideNgxMask } from 'ngx-mask';

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    NgxMaskDirective,
    NgxMaskPipe
  ],
  providers: [
    provideNgxMask()
  ],
  ...
})

For the ngx-mask provider, use the provideEnvironmentNgxMask (default config options application level) or provideNgxMask (config options feature level) method.

Yong Shun
  • 35,286
  • 4
  • 24
  • 46