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

misc(publish): include the report bundle in npm package #13349

Merged
merged 8 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ results.html
dist/**
!dist/report/standalone.js
!dist/report/flow.js
!dist/report/bundle.esm.js

# large files
changelog.md
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "8.6.0",
"description": "Automated auditing, performance metrics, and best practices for the web.",
"main": "./lighthouse-core/index.js",
"exports": {
".": "./lighthouse-core/index.js",
"./renderer": "./dist/report/bundle.esm.js"
},
Copy link
Collaborator

@connorjclark connorjclark Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When exports is defined, it means only files that match one of these rules may be imported from the package. See the output from yarn build-devtools for how this breaks pubads:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lighthouse-core/lib/i18n/i18n' is not defined by "exports" in /Users/runner/work/lighthouse/lighthouse/lighthouse/node_modules/lighthouse/package.json

Adding this line should fix it:

"./lighthouse-core/*": "./lighthouse-core/*"

"bin": {
"lighthouse": "./lighthouse-cli/index.js",
"chrome-debug": "./lighthouse-core/scripts/manual-chrome-launcher.js",
Expand All @@ -12,7 +16,7 @@
"node": ">=14.15"
},
"scripts": {
"prepack": "yarn build-report --standalone --flow",
"prepack": "yarn build-report --standalone --flow --esm",
"build-all": "npm-run-posix-or-windows build-all:task",
"build-all:task": "yarn build-report && yarn build-cdt-lib && yarn build-devtools && (yarn build-extension & yarn build-lr & yarn build-viewer & yarn build-treemap & yarn build-smokehouse-bundle & wait) && yarn build-pack",
"build-all:task:windows": "yarn build-report && yarn build-cdt-lib && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle",
Expand Down