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

angular2-masonry won't compile under Angular 5 #61

Open
web-snake opened this issue Nov 20, 2017 · 9 comments
Open

angular2-masonry won't compile under Angular 5 #61

web-snake opened this issue Nov 20, 2017 · 9 comments

Comments

@web-snake
Copy link

Angular 5 has stricter Typescript compilation configurations and will not compile:
node_modules/angular2-masonry/index.ts
The error is:
ERROR in ./node_modules/angular2-masonry/index.ts
Module build failed: Error: myapp/node_modules/angular2-masonry/index.ts is not part of the compilation output. Please check the other error messages for details.

This type script file is incorrectly packed in angular2-masonry according to the Angular team.
You should not package uncompiled .ts files in packages because it can compile diffferently under different configs.
Angular plans to make it even harder for you to use this bad practice in the future. YOur package is already broken for Angular 5.
Here's an Angular team member saying this: angular/angular-cli#8284
( see filipesilva 's comment )

@khalid-halo
Copy link

Any work around for the time being?

@JaronrH
Copy link

JaronrH commented Nov 24, 2017

Temporary workaround is to bring the angular2-masonry into a sub-folder of your app. You can that include it as usual using:

import { MasonryModule } from './angular2-masonry';

@rahulmodu
Copy link

hello JaronrH
if you import
like import { MasonryModule } from './angular2-masonry';
then ssr will not work

error come=>>>>>>>>>>>>>>>
}( window, function factory( Outlayer, getSize ) {
^

ReferenceError: window is not defined


if you running project via ng serve it will work fine

@Gorniv
Copy link

Gorniv commented Nov 30, 2017

@ElkeCodes
Copy link

Another workaround is to temporarily add the package in the include array of your tsconfig.json. My full tsconfig.json is this:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "include":[
    "node_modules/angular2-masonry",
    "src/**/*"
  ]
}

Note that by default there was no include present and I also had to add src/**/* into it to have full compilation of my project.

@gethinoakes
Copy link

I've forked this repository and updated it for Angular 5+
https://github.com/gethinoakes/ngx-masonry

Works fine for me. I'll try to work on it more when I have time.

@juhguu
Copy link

juhguu commented Jan 16, 2018

@gethinoakes ty. 👍

@Shailu4u
Copy link

Angular 5 Masonry Module with animations: https://github.com/Shailu4u/ng-masonry-grid

@renzo031109
Copy link

Thanks Shailu4u this works for me.

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

10 participants