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

ERROR Cannot find module 'imgix-url-params/dist/parameters.json' #140

Open
EmanH opened this issue Nov 17, 2020 · 6 comments
Open

ERROR Cannot find module 'imgix-url-params/dist/parameters.json' #140

EmanH opened this issue Nov 17, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@EmanH
Copy link

EmanH commented Nov 17, 2020

Can't build my angular project with this module.

ERROR in node_modules/@imgix/angular/lib/types.d.ts:1:32 - error TS2732: Cannot find module 'imgix-url-params/dist/parameters.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

1 import imgixUrlParameters from 'imgix-url-params/dist/parameters.json';
@EmanH EmanH added the bug Something isn't working label Nov 17, 2020
EmanH added a commit to EmanH/angular that referenced this issue Nov 17, 2020
@frederickfogerty
Copy link
Contributor

frederickfogerty commented Nov 18, 2020

Hey @EmanH, thanks (again) for opening this issue and the associated PR. As I discussed over in the PR, I think this is a valid bug so will think about a way to fix it. Let me know if you have any other ideas.

At the moment I think the best resolution is biting the bullet and exporting a TS definition from our imgix-url-params pacakge. In the short term, I think we might just have to set the type to a more generic type like { [k: string]: string | number }.

As a workaround for now until we fix this, is it possible for you to enable --resolveJsonModule in your tsconfig? This won't have any effect on the compiled code, since it's just for type checking.

By the way, in the future, could you please help us out by opening issues according to one of the issue templates? It really helps us!

@EmanH
Copy link
Author

EmanH commented Nov 19, 2020

Thanks Frederick,
I added resolveJsonModule into the tsconfig compiler options for the angular project, but it had no effect. Obviously didn't put it in the right place or right tsconfig file. Any tips on doing that in Angular?

@EmanH
Copy link
Author

EmanH commented Nov 20, 2020

I got resolveJsonModule working in the end. No problem.

@frederickfogerty
Copy link
Contributor

Hey @EmanH - glad you could get this working! We'll leave this open as we want to make it unnecessary to change your Typescript config to use this plugin.

@jeremiahmark
Copy link

Hey, I'm trying to use the library and getting the same issue how was this resolved in the past?

@Cdrew92
Copy link

Cdrew92 commented Jul 20, 2022

Angular 13.3.0 checking in. In addition to resolveJsonModule I had to set "allowSyntheticDefaultImports: true" in tsconfig to import ImgixAngularModule into my App Module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants