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

Missing dependency: lighthouse #334

Closed
rlaffers opened this issue Oct 18, 2022 · 2 comments · Fixed by #337
Closed

Missing dependency: lighthouse #334

rlaffers opened this issue Oct 18, 2022 · 2 comments · Fixed by #337
Assignees

Comments

@rlaffers
Copy link

Expected Behavior

The @puppeteer/replay is compiled without errors when it is installed as a dependency.

Actual Behavior

An error occurs when I bundle my app:

[vite]: Rollup failed to resolve import "lighthouse/core/fraggle-rock/api.js" from "node_modules/@puppeteer/replay/lib/main.js".

This is due to lighthouse missing from the dependencies and/or peerDependencies in package.json. lighthouse is listed only as a devDependency, while in fact it is a normal dependency since the library source depends on it.

Steps to Reproduce the Problem

  1. npm create vite@latest my-app -- --template vanilla
  2. cd my-app && npm install
  3. npm install --save @puppeteer/replay
  4. Import from @puppeteer/replay in the main.js file:
    import { PuppeteerRunnerExtension } from '@puppeteer/replay'
  5. npm run build

Specifications

  • Version: @puppeteer/replay@1.3.1, node 16.18.0
  • Platform: Linux
@OrKoN
Copy link
Collaborator

OrKoN commented Oct 19, 2022

@adamraine could you please take a look?

@adamraine
Copy link
Contributor

So we prevent Lighthouse from being bundled using rollup externals:

external: [...Object.keys(pkg.peerDependencies), /^lighthouse/],

I would expect tree shaking prevent rollup from using LighthouseRunnerExtension and therefore remove the need to import Lighthouse.

In any case, we should remove the lighthouse runner extension from the main bundle. Eventually we will make Lighthouse a peer dependency, but Lighthouse needs a lot of work with rollup plugins to work in bundled environments. If rollup can't automatically trim the Lighthouse import statements, maybe we should add a separate import path for Lighthouse like @puppeteer/replay/lighthouse.

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

Successfully merging a pull request may close this issue.

3 participants