puppeteer/assets/js/d25035e4.3c7bd785.js

1 line
7.9 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[65458],{19129:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>m,contentTitle:()=>u,default:()=>f,frontMatter:()=>l,metadata:()=>s,toc:()=>c});t(67294);var i=t(3905),a=t(93070),r=t(50551);function o(){return o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},o.apply(this,arguments)}function p(e,n){if(null==e)return{};var t,i,a=function(e,n){if(null==e)return{};var t,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}const l={},u="Configuration",s={unversionedId:"guides/configuration",id:"guides/configuration",title:"Configuration",description:"All defaults in Puppeteer can be customized in two ways:",source:"@site/../docs/guides/configuration.mdx",sourceDirName:"guides",slug:"/guides/configuration",permalink:"/next/guides/configuration",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"docs",previous:{title:"Guides",permalink:"/next/category/guides"},next:{title:"Query Selectors",permalink:"/next/guides/query-selectors"}},m={},c=[{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:"Enabling experiments",id:"enabling-experiments",level:4},{value:"Environment variables",id:"environment-variables",level:2}],d={toc:c};function f(e){var{components:n}=e,t=p(e,["components"]);return(0,i.kt)("wrapper",o({},d,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",o({},{id:"configuration"}),"Configuration"),(0,i.kt)("p",null,"All defaults in Puppeteer can be customized in two ways:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("a",o({parentName:"li"},{href:"#configuration-files"}),"Configuration files")," (",(0,i.kt)("strong",{parentName:"li"},"recommended"),")"),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("a",o({parentName:"li"},{href:"#environment-variables"}),"Environment variables"))),(0,i.kt)("admonition",o({},{type:"caution"}),(0,i.kt)("p",{parentName:"admonition"},"Note that some options are only customizable through environment variables (such\nas ",(0,i.kt)("inlineCode",{parentName:"p"},"HTTPS_PROXY"),").")),(0,i.kt)("admonition",o({},{type:"caution"}),(0,i.kt)("p",{parentName:"admonition"},"Puppeteer's configuration files and environment variables are ignored by ",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer-core"),".")),(0,i.kt)("h2",o({},{id:"configuration-files"}),"Configuration files"),(0,i.kt)("p",null,"Configuration files are the ",(0,i.kt)("strong",{parentName:"p"},"recommended")," choice for configuring Puppeteer.\nPuppeteer will look up the file tree for any of the following formats:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".puppeteerrc.cjs"),","),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".puppeteerrc.js"),","),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".puppeteerrc")," (YAML/JSON),"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".puppeteerrc.json"),","),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},".puppeteerrc.yaml"),","),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.config.js"),", and"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.config.cjs"))),(0,i.kt)("p",null,"Puppeteer will also read a ",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer")," key from your application's\n",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),"."),(0,i.kt)("p",null,"See the ",(0,i.kt)("a",o({parentName:"p"},{href:"../api/puppeteer.configuration"}),(0,i.kt)("inlineCode",{parentName:"a"},"Configuration")),