PageSourceSearch

https://rsbuild.rs/static/js/async/route-2b6c9442a8a9.5fc14b9603.js

js rsbuild.rs collected 2026-10-03 19:20:21 UTC 10,240 bytes, 1 lines download raw bytes

1"use strict";(self.rspackChunkrsbuild_website=self.rspackChunkrsbuild_website||[]).push([["am"],{tj(e,s,n){n.r(s);var l=n("E"),r=n("HC"),i=n("x");function o(e){let s={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",span:"span",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(s.h1,{id:"outputlegalcomments",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#outputlegalcomments",children:"#"}),"output.legalComments"]}),"\n",(0,l.jsxs)(s.ul,{children:["\n",(0,l.jsxs)(s.li,{children:[(0,l.jsx)(s.strong,{children:"Type:"})," ",(0,l.jsx)(s.code,{children:"'linked' | 'inline' | 'none'"})]}),"\n",(0,l.jsxs)(s.li,{children:[(0,l.jsx)(s.strong,{children:"Default:"})," ",(0,l.jsx)(s.code,{children:"'linked'"})]}),"\n"]}),"\n",(0,l.jsx)(s.p,{children:"Controls how legal comments are handled in the build output."}),"\n",(0,l.jsxs)(s.h2,{id:"what-are-legal-comments",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#what-are-legal-comments",children:"#"}),"What are legal comments?"]}),"\n",(0,l.jsx)(s.p,{children:'A "legal comment" is any statement-level comment in JS or rule-level comment in CSS that contains @license or @preserve, or that starts with //! or /*!. These comments are preserved in output files by default since that follows the intent of the original authors of the code.'}),"\n",(0,l.jsxs)(s.p,{children:["For example, the ",(0,l.jsx)(s.code,{children:"LICENSE"})," comment in React:"]}),"\n",(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(s.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",lang:"js",children:(0,l.jsxs)(s.code,{children:[(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:"/**"})}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * "}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"@license"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" React"})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * react.production.js"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" *"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * Copyright (c) Meta Platforms, Inc. and affiliates."})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" *"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * This source code is licensed under the MIT license found in the"})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" * LICENSE file in the root directory of this source tree."})}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-comment)"},children:" */"})})]})})}),"\n",(0,l.jsxs)(s.h2,{id:"optional-values",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#optional-values",children:"#"}),"Optional values"]}),"\n",(0,l.jsx)(s.p,{children:"You can control how legal comments are handled using these options:"}),"\n",(0,l.jsxs)(s.h3,{id:"linked",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#linked",children:"#"}),(0,l.jsx)(s.code,{children:"linked"})]}),"\n",(0,l.jsxs)(s.p,{children:["Extracts all legal comments to ",(0,l.jsx)(s.code,{children:"*.LICENSE.txt"})," files and links to them with a comment."]}),"\n",(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(s.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",title:"rsbuild.config.js",lang:"js",children:(0,l.jsxs)(s.code,{children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:" default"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  output"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"    legalComments"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:" 'linked'"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  }"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"};"})})]})})}),"\n",(0,l.jsxs)(s.p,{children:[(0,l.jsx)(s.code,{children:".LICENSE.txt"})," files are not loaded by the page, so they will not affect the page's performance."]}),"\n",(0,l.jsxs)(s.h3,{id:"inline",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#inline",children:"#"}),(0,l.jsx)(s.code,{children:"inline"})]}),"\n",(0,l.jsx)(s.p,{children:"Preserves all legal comments in their original position. This may increase the size of the output bundles."}),"\n",(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(s.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",title:"rsbuild.config.js",lang:"js",children:(0,l.jsxs)(s.code,{children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:" default"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  output"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"    legalComments"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:" 'inline'"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  }"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"};"})})]})})}),"\n",(0,l.jsxs)(s.h3,{id:"none",children:[(0,l.jsx)(s.a,{className:"rp-header-anchor","aria-hidden":"true",href:"#none",children:"#"}),(0,l.jsx)(s.code,{children:"none"})]}),"\n",(0,l.jsx)(s.p,{children:"Removes all legal comments."}),"\n",(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(s.pre,{className:"shiki css-variables",style:{backgroundColor:"var(--shiki-background)",color:"var(--shiki-foreground)"},tabIndex:"0",title:"rsbuild.config.js",lang:"js",children:(0,l.jsxs)(s.code,{children:[(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:"export"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:" default"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  output"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:" {"})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"    legalComments"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-keyword)"},children:":"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-string-expression)"},children:" 'none'"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsxs)(s.span,{className:"line",children:[(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"  }"}),(0,l.jsx)(s.span,{style:{color:"var(--shiki-token-punctuation)"},children:","})]}),"\n",(0,l.jsx)(s.span,{className:"line",children:(0,l.jsx)(s.span,{style:{color:"var(--shiki-foreground)"},children:"};"})})]})})}),"\n",(0,l.jsx)(i.Pq,{type:"tip",title:"Tip",children:(0,l.jsx)(s.p,{children:"\nRemoving license comments may violate the terms of some software licenses. Please ensure you have the right to remove these comments before using this option."})})]})}function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,l.jsx)(s,{...e,children:(0,l.jsx)(o,{...e})}):o(e)}a.__RSPRESS_PAGE_META={},a.__RSPRESS_PAGE_META["en%2Fconfig%2Foutput%2Flegal-comments.mdx"]={toc:[{id:"what-are-legal-comments",text:"What are legal comments?",depth:2},{id:"optional-values",text:"Optional values",depth:2},{id:"linked",text:"`linked`",depth:3},{id:"inline",text:"`inline`",depth:3},{id:"none",text:"`none`",depth:3}],title:"output.legalComments",headingTitle:"output.legalComments",frontmatter:{description:"Controls how legal comments are handled in the build output."}},n.d(s,{default:()=>a})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.