diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c654ac..bafc4e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 14.0.1 + +- Use ES6 import for CJS module + ## 14.0.0 - Angular 14 update and Ivy build diff --git a/package.json b/package.json index 822b2c2..5dfb265 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-masonry", - "version": "14.0.0", + "version": "14.0.1", "description": "Angular Module for displaying a feed of items in a masonry layout using https://github.com/desandro/masonry", "keywords": [ "angular", diff --git a/src/lib/ngx-masonry.component.ts b/src/lib/ngx-masonry.component.ts index 9cb15ff..8332247 100644 --- a/src/lib/ngx-masonry.component.ts +++ b/src/lib/ngx-masonry.component.ts @@ -2,9 +2,7 @@ import { isPlatformBrowser } from '@angular/common'; import { Component, ElementRef, EventEmitter, Inject, Input, OnChanges, OnDestroy, OnInit, Output, PLATFORM_ID, SimpleChanges } from '@angular/core'; import { NgxMasonryOptions } from './ngx-masonry-options'; import { NgxMasonryDirective } from './ngx-masonry.directive'; - -declare var require: any; -let masonryConstructor: any; +import Masonry from 'masonry-layout'; @Component({ selector: '[ngx-masonry], ngx-masonry', @@ -36,10 +34,6 @@ export class NgxMasonryComponent implements OnInit, OnChanges, OnDestroy { ngOnInit() { - if (isPlatformBrowser(this.platformId) && masonryConstructor === undefined) { - masonryConstructor = require('masonry-layout'); - } - // Create masonry options object if (!this.options) { this.options = {}; @@ -54,7 +48,7 @@ export class NgxMasonryComponent implements OnInit, OnChanges, OnDestroy { if (isPlatformBrowser(this.platformId)) { // Initialize Masonry - this.masonryInstance = new masonryConstructor(this._element.nativeElement, this.options); + this.masonryInstance = new Masonry(this._element.nativeElement, this.options); // Bind to events this.masonryInstance.on('layoutComplete', (items: any) => {