Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Cannot find module '../../node_modules/ng2-inline-svg/lib/inline-svg.directive.ngfactory' #13

Closed
tadchristiansenli opened this issue Nov 9, 2016 · 15 comments

Comments

@tadchristiansenli
Copy link

After upgrading to angular 2.1.1 and ng2-inline-svg 1.2.0. I am getting the following errors everywhere I use inline-svg:
Cannot find module '../../node_modules/ng2-inline-svg/lib/inline-svg.directive.ngfactory'

Ionic had a similar issue here
ionic-team/ionic-app-scripts#214

and they fixed it with this commit:
ionic-team/ionic-framework@98d474b

I looked in the lib directory (generated js files) and the module exports the directive. I am not sure why this is breaking. Thoughts?

@arkon
Copy link
Owner

arkon commented Nov 9, 2016

I'm not entirely sure, since the factories shouldn't be published anyway.

This might help? Or this. This too.

@tadchristiansenli
Copy link
Author

I saw the first two, and I am currently reading through the third. I assume you have an app where you can try updating the version to angular 2.1.1 (or 2.1.2) and see if it happens for you as well? If I downgrade angular it works fine. Are you willing to try an ngc build with angular 2.1.1 to see if you can reproduce this?

@arkon
Copy link
Owner

arkon commented Nov 9, 2016

I don't currently have an app that uses AOT compilation (since I use Webpack, and I haven't gotten around to configuring it to use ngc instead of tsc), so unfortunately I can't help much.

@tadchristiansenli
Copy link
Author

Ok, I will keep digging and let you know what I find.

@tadchristiansenli
Copy link
Author

It looks like I can get everything working on my side by downgrading to 2.0.1 so I am good for now. I will let you know if I find out what is going on.

@janein
Copy link

janein commented Nov 16, 2016

Is there any news on this @tadchristiansenli ?

@tadchristiansenli
Copy link
Author

Unfortunately no. I reverted back to angular 2.0.1 after failing to figure this out. Let me know if you are able to figure anything out.

@tadchristiansenli
Copy link
Author

@janein Were you able to figure anything out?

@arkon
Copy link
Owner

arkon commented Nov 29, 2016

@tadchristiansenli @janein How are you guys importing ng2-inline-svg in your project?

@arkon
Copy link
Owner

arkon commented Nov 29, 2016

Note to self: this may be a useful reference
valor-software/ngx-bootstrap#1093

@tadchristiansenli
Copy link
Author

tadchristiansenli commented Nov 29, 2016

@arkon

package.json
"ng2-inline-svg": "1.2.0"

app.module.ts:
import {InlineSVGModule} from "ng2-inline-svg";
...

imports: [
		IonicModule.forRoot(MyApp),
		InlineSVGModule,
...

The issue shows up when using AoT and that is probably why you don't see the issue. Ionic 2 uses AoT by default. Let me know if you have any other questions.

Oddly enough it works with angular 2.0.1 but not 2.1.1

@arkon
Copy link
Owner

arkon commented Nov 29, 2016

@tadchristiansenli Could you try v1.3.1 if you have time? It's pretty much just a shot in the dark though...

@tadchristiansenli
Copy link
Author

Sure, I will give it a shot and let you know.

@tadchristiansenli
Copy link
Author

I upgraded to ionic rc2 and angular 2.1.1 and v1.3.1 and it looks like the issue has been resolved. I am not sure why moving the module to its own file fixed this though. Thoughts? What made you think to try that?

@arkon
Copy link
Owner

arkon commented Nov 30, 2016

@tadchristiansenli I was reading through the ng2-bootstrap issue I posted earlier, and their issue was resolved when they did that. I suspect it has something to do with how ngc is parsing/generating files based on what's present/imported/exported, but I'm not sure what the exact reasoning is.

Either way, I guess this is resolved. ¯\_(ツ)_/¯

@arkon arkon closed this as completed Nov 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants