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

Variables conflict: imported module and local variable have the same name #3746

Closed
cyberalien opened this issue Aug 26, 2020 · 1 comment · Fixed by #3747
Closed

Variables conflict: imported module and local variable have the same name #3746

cyberalien opened this issue Aug 26, 2020 · 1 comment · Fixed by #3747

Comments

@cyberalien
Copy link

Expected Behavior

Original code:

import { stringToIcon, validateIcon } from '@iconify/core/lib/icon/name';

export function cleanIconName(name) {
	if (typeof name === 'string') {
		name = stringToIcon(name);
	}
	return name === null || !validateIcon(name) ? null : name;
}

Expected to remain about the same after bundling

Actual Behavior

Same function from bundle generated by rollup:

	function cleanIconName(name) {
		if (typeof name === 'string') {
			name = name.stringToIcon(name);
		}
		return name === null || !name.validateIcon(name) ? null : name;
	}

Function stringToIcon imported from an external module was assigned to variable name, so it became name.stringToIcon. Also parameter of cleanIconName where stringToIcon is used has name name.

Because of that, instead of calling function, code throws an error.

@lukastaegert
Copy link
Member

Thanks for spotting, fix at #3747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants