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

Uncaught TypeError: Cannot set properties of undefined (setting 'srcAttribute') #345

Open
jacobgraf opened this issue Jun 12, 2023 · 1 comment
Assignees

Comments

@jacobgraf
Copy link

When importing import imgix from 'imgix.js';, setting config options leads to a console error...

Uncaught TypeError: Cannot set properties of undefined (setting 'srcAttribute')

If I check imgix.config directly in the console, it's there, so it sounds like a race issue? Am I missing something here?

import imgix from 'imgix.js';

imgix.config.srcAttribute = 'data-src';
imgix.config.srcsetAttribute = 'data-srcset';
imgix.config.sizesAttribute = 'data-sizes';
@mattlaguardia
Copy link

mattlaguardia commented Jun 14, 2023

Hi @jacobgraf, thank you for bringing this to our attention. I was hoping you could provide some additional information as I try to reproduce. What version of node installed the dependency?

Does importing imgix.js globally fix your uncaught error:

import 'imgix.js';

imgix.config.srcAttribute = 'data-src';
imgix.config.srcsetAttribute = 'data-srcset';
imgix.config.sizesAttribute = 'data-sizes';

@mattlaguardia mattlaguardia self-assigned this Jun 14, 2023
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

2 participants