zefoy / ngx-dropzone-wrapper

Angular wrapper library for Dropzone
MIT License
174 stars 51 forks source link

Window is not defined at contentLoaded #115

Open yura-moryliak opened 6 years ago

yura-moryliak commented 6 years ago

Hi there! I have a problem with Angular SSR when i'm running npm run serve:ssr. I'm facing issue with contentLoaded(window, Dropzone._autoDiscoverFunction);

Is there exist a solution for this case? Thanks

sconix commented 6 years ago

Did you find a solution?

yura-moryliak commented 6 years ago

Unfortunately nope, to save time i'm using https://github.com/ZouYouShun/ngxf-uploader component to finish my SSR.

logan-jobzmall commented 5 years ago

@sconix @yura-moryliak The issue is coming from dropzone.directive.ts. The import * as Dropzone from 'dropzone'; line will cause this issue. Dropzone should be imported using require() inside of a isPlatformBrowser block. The only caveat is that you have to set the moduleResolution in your tsconfig to node. This should fix all the SSR issues. Let me know if you need a PR.