xmaestro / angular2-recaptcha

Angular 2 : Typescript component for Google reCaptcha
ISC License
79 stars 30 forks source link

Module not found, during AOT build #38

Closed PostImpatica closed 7 years ago

PostImpatica commented 8 years ago

If anyone else gets this error, I figured I'd post my fix to save you time. I had the following error:

Module not found: Error: Can't resolve '../../../../../node_modules/angular2- recaptcha/lib/captcha.component.ngfactory' in '<some path>/<some component>'

I removed the ReCaptcha module and instead manually pull in the service and the component and now everything builds properly.

'angular2-recaptcha/lib/captcha.component', 'angular2-recaptcha/lib/captcha.service',

I'm using the qdouble/angular-webpack2-starter

intellix commented 7 years ago

thanks for this :) it worked for me when I got errors in angular-cli as well. The issue was closed but I think there's still an issue here with this project and AOT:

Cannot read property 'ReCaptchaComponent' of undefined, resolving symbol ReCaptchaModule.
xmaestro commented 7 years ago

@intellix and @helzgate What changes do you suggest I should make to accommodate AOT? Unfortunately, I'm not using Angular with AOT which puts me at a disadvantage. I have already added factory files.

thorsten commented 7 years ago

Same issue here.

achimha commented 7 years ago

With Angular 2.4.0 and angular-cli 1.0.0-beta24, I have no problems using this module with AOT.

eranat commented 7 years ago

@xmaestro, Are you going to fix it?

xmaestro commented 7 years ago

@eranat Apparently, there is nothing to fix. As @achimha said, it works fine with 2.4.

eranat commented 7 years ago

I'm also working with 2.4.0 and it is not working for me. When I'm running the command: "node_modules/.bin/ngc" -p tsconfig-aot.json

I'm getting the error: Can't export value ReCaptchaModule in ../node_modules/angular2-recaptcha/angular2-recaptcha.js from SharedModule in ../app/shared/shared.module.ts as it was neither declared nor imported!

"dependencies": "@angular/common": "^2.4.0", "@angular/compiler": "^2.4.0", "@angular/compiler-cli": "^2.4.0", "@angular/core": "^2.4.0", "@angular/forms": "^2.4.0", "@angular/http": "^2.4.0", "@angular/platform-browser": "^2.4.0", "@angular/platform-browser-dynamic": "^2.4.0", "@angular/platform-server": "^2.4.1", "@angular/router": "^3.4.0", "@angular/upgrade": "^2.4.1", "angular2-recaptcha": "^0.3.6",

achimha commented 7 years ago

Please provide a reproduction testcase in a github repo.

I have no problems using angular-cli and AOT.