mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
|
/*! For license information please see 0552d76e.6163d25b.js.LICENSE.txt */
|
||
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[50958],{26551:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>t,metadata:()=>c,toc:()=>a});var r=i(85893),o=i(11151);i(53787),i(50551);const t={},s="Configuration",c={id:"guides/configuration",title:"Configuration",description:"All defaults in Puppeteer can be customized in two ways:",source:"@site/versioned_docs/version-22.0.0/guides/configuration.mdx",sourceDirName:"guides",slug:"/guides/configuration",permalink:"/guides/configuration",draft:!1,unlisted:!1,tags:[],version:"22.0.0",frontMatter:{},sidebar:"docs",previous:{title:"Guides",permalink:"/category/guides"},next:{title:"Query Selectors",permalink:"/guides/query-selectors"}},l={},a=[{value:"Configuration files",id:"configuration-files",level:2},{value:"Examples",id:"examples",level:3},{value:"Changing the default cache directory",id:"changing-the-default-cache-directory",level:4},{value:"Environment variables",id:"environment-variables",level:2}];function d(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h4:"h4",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"configuration",children:"Configuration"}),"\n","\n","\n",(0,r.jsx)(n.p,{children:"All defaults in Puppeteer can be customized in two ways:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.a,{href:"#configuration-files",children:"Configuration files"})," (",(0,r.jsx)(n.strong,{children:"recommended"}),")"]}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"#environment-variables",children:"Environment variables"})}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"caution",children:(0,r.jsxs)(n.p,{children:["Note that some options are only customizable through environment variables (such\nas ",(0,r.jsx)(n.code,{children:"HTTPS_PROXY"}),")."]})}),"\n",(0,r.jsx)(n.admonition,{type:"caution",children:(0,r.jsxs)(n.p,{children:["Puppeteer's configuration files and environment variables are ignored by ",(0,r.jsx)(n.code,{children:"puppeteer-core"}),"."]})}),"\n",(0,r.jsx)(n.h2,{id:"configuration-files",children:"Configuration files"}),"\n",(0,r.jsxs)(n.p,{children:["Configuration files are the ",(0,r.jsx)(n.strong,{children:"recommended"})," choice for configuring Puppeteer.\nPuppeteer will look up the file tree for any of the following formats:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:".puppeteerrc.cjs"}),","]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:".puppeteerrc.js"}),","]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:".puppeteerrc"})," (YAML/JSON),"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:".puppeteerrc.json"}),","]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:".puppeteerrc.yaml"}),","]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"puppeteer.config.js"}),", and"]}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"puppeteer.config.cjs"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["Puppeteer will also read a ",(0,r.jsx)(n.code,{children:"puppeteer"})," key from your application's\n",(0,r.jsx)(n.code,{children:"package.json"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["See the ",(0,r.jsx)(n.a,{href:"../api/puppeteer.configuration",children:(0,r.jsx)(n.code,{children:"Configuration"})})," interface for possible\noptions."]}),"\n",(0,r.jsx)(n.admonition,{type:"caution",children:(0,r.jsxs)(n.p,{children:["After adding a configuration file, you may need to remove and reinstall\n",(0,r.jsx)(n.code,{children:"puppeteer"})," for it to take effect if the changes affect installation."]})}),"\n",(0,r.jsx)(n.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(n.h4,{id:"changing-the-default-cache-directory",children:"Changing the default cache directory"}),"\n",(0,r.jsxs)(n.p,{children:["Starting in v19.0.0, Puppeteer stores browsers in ",(0,r.jsx)(n.code,{children:"~/.cache/puppeteer"})," to\nglobally cache b
|