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

Using npm lighthouse with dynamic import #15600

Closed
chaitanya1248 opened this issue Nov 10, 2023 · 3 comments
Closed

Using npm lighthouse with dynamic import #15600

chaitanya1248 opened this issue Nov 10, 2023 · 3 comments
Assignees

Comments

@chaitanya1248
Copy link

using lighthouse version 11.2.0

Trying to import lighthouse using dynamic import in a typescript, node project.

Snippet:
Import('lighthouse').then(async () => {
const result = await lighthouse(url, flags, config);
// getting an error "this expression is not callable"
}

@adamraine
Copy link
Member

adamraine commented Nov 10, 2023

Looks like you didn't add the correct param to the promise callback:

import('lighthouse').then(async ({default: lighthouse}) => {
	const result = await lighthouse(url, flags, config);
}

@adamraine adamraine closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
@chaitanya1248
Copy link
Author

Even after adding param, it complains lighthouse is not callable. I had to explicitly use the default like:
Lighthouse.default(url, flags, config)
In order to make it work.

@adamraine
Copy link
Member

Ah you're right, my bad. Forgot that's how node make you use the default param. Updated my comment.

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

3 participants