feat(templates): use ImpitHttpClient and install optional deps in Docker#3603
feat(templates): use ImpitHttpClient and install optional deps in Docker#3603
Conversation
Wires ImpitHttpClient as the default httpClient for every template crawler and drops --omit=optional from the final-stage npm install so impit's platform-specific native binaries (shipped via optionalDependencies) land in the production image. The camoufox-ts template uses the Firefox fingerprint; the others use Chrome. Addresses #3601.
|
Here's the size comparison for different Docker images after dropping
For both cheerio and playwright, the difference is basically just |
|
It will be more important to do this in https://github.com/apify/actor-templates |
There was a problem hiding this comment.
Pull request overview
This PR soft-launches Impit as the default HTTP client in Crawlee project templates and updates template Dockerfiles so Impit’s platform-specific native binaries (distributed via optionalDependencies) are installed in production images.
Changes:
- Inject
httpClient: new ImpitHttpClient(...)into crawler instantiations across templates. - Add
@crawlee/impit-clientto templatedependencies. - Remove
--omit=optionalfrom template Dockerfile production installs so optional native binaries are included.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/templates/templates/puppeteer-ts/src/main.ts | Configure PuppeteerCrawler to use ImpitHttpClient. |
| packages/templates/templates/puppeteer-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/puppeteer-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/puppeteer-js/src/main.js | Configure PuppeteerCrawler to use ImpitHttpClient. |
| packages/templates/templates/puppeteer-js/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/puppeteer-js/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/playwright-ts/src/main.ts | Configure PlaywrightCrawler to use ImpitHttpClient. |
| packages/templates/templates/playwright-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/playwright-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/playwright-js/src/main.js | Configure PlaywrightCrawler to use ImpitHttpClient. |
| packages/templates/templates/playwright-js/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/playwright-js/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/getting-started-ts/src/main.ts | Configure PlaywrightCrawler to use ImpitHttpClient. |
| packages/templates/templates/getting-started-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/getting-started-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/getting-started-js/src/main.js | Configure PlaywrightCrawler to use ImpitHttpClient. |
| packages/templates/templates/getting-started-js/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/getting-started-js/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/empty-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/empty-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/empty-js/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/empty-js/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/cheerio-ts/src/main.ts | Configure CheerioCrawler to use ImpitHttpClient. |
| packages/templates/templates/cheerio-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/cheerio-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/cheerio-js/src/main.js | Configure CheerioCrawler to use ImpitHttpClient. |
| packages/templates/templates/cheerio-js/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/cheerio-js/Dockerfile | Install prod deps without omitting optionalDependencies. |
| packages/templates/templates/camoufox-ts/src/main.ts | Configure PlaywrightCrawler (Camoufox/Firefox) to use ImpitHttpClient. |
| packages/templates/templates/camoufox-ts/package.json | Add @crawlee/impit-client dependency. |
| packages/templates/templates/camoufox-ts/Dockerfile | Install prod deps without omitting optionalDependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0", | ||
| "puppeteer": "*" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0", | ||
| "puppeteer": "*" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0", | ||
| "playwright": "1.58.2" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0", | ||
| "playwright": "1.58.2" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0", | ||
| "playwright": "1.58.2" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0" | ||
| }, |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "crawlee": "^3.0.0" | ||
| }, |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
| }, | |
| }, | |
| "engines": { | |
| "node": ">=20" | |
| }, |
| "dependencies": { | ||
| "@crawlee/impit-client": "^3.0.0", | ||
| "camoufox-js": "^0.9.0", | ||
| "crawlee": "^3.0.0", | ||
| "playwright": "1.58.2" |
There was a problem hiding this comment.
Adding @crawlee/impit-client introduces a Node.js >=20 requirement (the package declares engines.node >=20). This template package.json doesn’t declare an engines constraint, so users on Node 16/18 can hit install failures/warnings. Consider adding an engines field (or otherwise documenting/enforcing Node >=20 for templates using Impit).
…plates The empty-* templates ship no crawler, so pulling in @crawlee/impit-client and re-enabling optional deps in their Dockerfile has no effect beyond bloating the install. Restore their original state.

Soft-launches Impit as the default HTTP client in all Crawlee templates and removes
--omit=optionalfrom the productionnpm installin the template Dockerfiles so thatimpit's platform-specific native binaries — shipped viaoptionalDependencies— actually land in the image.Closes #3601.