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

be explicit about extensions when importing lighthouse modules #318

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Nov 10, 2021

Before lighthouse can use the new exports feature of package.json, we need to fix some imports here. Specifying the extension is considered a best practice for a few reasons:

  1. the node module resolution algorithm is pretty complex, and optional extensions are part of the reason why
  2. ES modules running in browsers don't necessarily require an extension, but imports won't be rewritten to try with an implied js extension (the browser will only request of the server exactly the import string). Technically one could leave out extensions and configure a server to resolve files correctly / serve JS files without an extension, but obviously no one does that. So browser code is always going to have imports ending with .js. All that to say, the consistency is nice across JS environments.

@google-cla google-cla bot added the cla: yes CLA has been signed label Nov 10, 2021
@jburger424
Copy link
Contributor

CC: @avparmar

@jburger424 jburger424 merged commit 9d93775 into googleads:master Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes CLA has been signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants