ngx-bootstrap Module not found: Error: Can't resolve 'ngx-bootstrap/loader'

Discussão em 'Angular' iniciado por Jacques, Novembro 9, 2024.

  1. Jacques

    Jacques Guest

    I'm using datepicker from ngx-bootstrap@3.2.0 in an Angular 6.1.10 project. I'm also loading a different locale (nlLocale).

    In my feature module:

    import { defineLocale, nlLocale, BsDatepickerModule, BsLocaleService} from 'ngx-bootstrap';

    defineLocale('nl', nlLocale);


    In my component:

    import { BsLocaleService } from 'ngx-bootstrap';
    export class MyComponent implements OnInit {
    locale = 'nl';

    constructor(private bsLocaleService: BsLocaleService) {
    this.bsLocaleService.use(this.locale);
    }
    }


    When I build this using the command:

    ng build --watch


    I have no problems, I can run the app, use the datepicker and the months appear in Dutch.

    However when I build for production:

    ng build --prod


    I get the following error:
    ERROR in ./node_modules/ngx-bootstrap/datepicker/fesm5/ngx-bootstrap-datepicker.js Module not found: Error: Can't resolve 'ngx-bootstrap/loader' in 'E:\MyProject\node_modules\ngx-bootstrap\datepicker\fesm5' ERROR in ./node_modules/ngx-bootstrap/modal/fesm5/ngx-bootstrap-modal.js Module not found: Error: Can't resolve 'ngx-bootstrap/loader' in 'E:\MyProject\node_modules\ngx-bootstrap\modal\fesm5'

    I've looked for the file 'ngx-bootstrap-datepicker.js' which exists in 'fesm5' but I see no reference inside the file to anything related to ngx-bootstrap/loader'.

    I've tried downgrading to ngx-bootstrap@3.0.1 and it does work so it obviously indicates a problem with ngx-bootstrap, but from some reading I've been doing others don't seem to be having this problem.

    Anyone come across this before?

    Continue reading...

Compartilhe esta Página