index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/browser-compatibility.md
# Browser Compatibility This chapter introduces how to use the capabilities provided by Builder to deal with browser compatibility issues. ## Set browserslist Before dealing with compatibility issues, you first need to clarify which browsers your project needs to support, and add the corresponding browserslist confi...
6,800
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/browserslist.md
# Browserslist Builder supports using [Browserslist](https://browsersl.ist/) to specify which browsers should be supported in your Web application. ## What is Browserslist Since different browsers support ECMAScript and CSS differently, developers need to set the correct browser range for web applications. [Browser...
6,801
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/custom-webpack-config.md
# Custom webpack config Builder supports directly modifying webpack configuration objects, and also supports deep customization of webpack configuration through webpack-chain. ## Modify the webpack configuration object You can use [tools.webpack](/api/config-tools.html#toolswebpack) to modify the webpack configurati...
6,802
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/define.md
# Environment Variables Builder supports injecting environment variables or expressions into the code during compilation, which is helpful for distinguishing the running environment or injecting constant values. This chapter introduces how to use environment variables. ## Default Variables ### process.env.NODE_ENV ...
6,803
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/hmr.md
# Hot Module Replacement Hot Module Replacement (HMR) exchanges, adds, or removes modules while an application is running, without a full reload. This can significantly speed up development in a few ways: - Retain application state which is lost during a full reload. - Save valuable development time by only updating ...
6,804
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/rem.md
# REM adaptation Builder supports REM adaptation via [output.convertToRem](/en/api/config-output.html#outputconverttorem), which can dynamically adjusts the font size according to the screen size, so that the page will be displayed correctly on different screen sizes. ## Enabling REM adaptability By setting `output....
6,805
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/rspack-start.mdx
# Using Rspack This document will show you how to enable Rspack build mode in the Builder. import Rspack from '@en/shared/rspackTip.mdx'; <Rspack /> ## Enable Rspack ### Enable in Modern.js framework Modern.js framework uses webpack as the default bundler. If you want to use Rspack as the bundler, you can refer t...
6,806
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/source-build.md
# Source Code Build Mode The source code build mode is used in the monorepo development scenario, allowing developers to directly reference the source code of other sub-projects within the monorepo for development. ## Use Cases In a monorepo, there are two main ways for projects to reference each other: artifact ref...
6,807
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/advanced/storybook.md
# Using Storybook [Storybook](https://storybook.js.org/) is a tool dedicated to component debugging, providing around component development. - Develop UIs that are more durable - Test UIs with less effort and no flakes - Document UI for your team to reuse - Share how the UI actually works - Automate UI workflows Bef...
6,808
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/build-target.md
# Build Target Builder supports build multiple target types for running in different target environments. After setting the correct target type, Builder will optimize the build results for the environment, and enable some plugins or configs for the target environment during the build process. You can set the type thr...
6,809
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/builder-cli.mdx
# Use Builder CLI Modern.js Builder provides a lightweight CLI tool that includes basic commands such as `dev` and `build`. It is primarily used for building non-React projects. - For React projects, we recommend using the Modern.js framework directly. Please refer to [Modern.js - Quick Start](https://modernjs.dev/en...
6,810
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/builder-config.mdx
# Builder Config Builder provides a wealth of configs to help users customize the build behavior. ## Config Categories Builder Configs are divided into the following categories: - [Dev Config](/api/config-dev.html): Config related to local development. - [Html Config](/api/config-html.html): Config related to HTML....
6,811
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/css-modules.md
# Use CSS Modules [CSS Modules](https://github.com/css-modules/css-modules) allows us to write CSS code in a modular way, and these styles can be imported and used in JavaScript files. Using CSS Modules can automatically generate unique class names, isolate styles between different modules, and avoid class name confli...
6,812
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/css-usage.md
# CSS Usage Builder has built-in multiple style resource processing capabilities, including Less / Sass preprocessor, PostCSS, CSS Modules, CSS inline and CSS compression. In addition, Builder also provides multiple configs to customize the compile rules of style resources. ## Using Less, Sass and Stylus The Builde...
6,813
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/html-template.md
# HTML Template During the build process, Builder will compile based on the HTML template and template parameters to generate several HTML files. Builder provides some configs to set the HTML template. Through this chapter, you can learn the basic usage of these configs. ## Set Template HTML templates are usually p...
6,814
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/json-files.md
# Import JSON Files Builder supports import JSON files in code, and also supports import [YAML](https://yaml.org/) and [Toml](https://toml.io/en/) files and converting them to JSON format. ## JSON file You can import JSON files directly in JavaScript files. ### Example ```json title="example.json" { "name": "foo...
6,815
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/output-files.md
# Output Files This chapter will introduces the directory structure of output files and how to control the output directory of different types of files. ## Default Directory Structure The following is a basic directory for output files. By default, the compiled files will be output in the `dist` directory of current...
6,816
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/static-assets.md
# Import Static Assets Builder supports import static assets, including images, fonts, and medias. :::tip What is Static Assets Static assets are files that are part of a web application and do not change, even when the application is being used. Examples of static assets include images, fonts, medias, stylesheets, a...
6,817
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/svg-assets.md
# Import SVG Assets Builder supports import SVG assets and transform SVG into React components or URLs. :::tip What is SVG SVG stands for Scalable Vector Graphics. It is a type of image format that uses vector graphics to represent images. Vector graphics are different from raster graphics, which are made up of pixel...
6,818
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/typescript.md
# Use TypeScript Builder supports TypeScript compilation and type checking by default, you can use `. ts` and `. tsx' files in the project without any configuration. ## TypeScript compilation Builder has three ways to compile TypeScript files. **Babel** By default, all TypeScript files are compiled by Babel. You ...
6,819
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/basic/wasm-assets.md
# Import Wasm Assets Builder supports import WebAssembly assets in code. :::tip What is WebAssembly WebAssembly (Wasm) is a portable, high-performance binary format designed to execute CPU-intensive computing tasks in modern web browsers, bringing performance and reliability similar to native compiled code to the web...
6,820
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/debug/debug-mode.md
# Debug Mode Builder provides a debug mode to troubleshoot problems, you can add the `DEBUG=builder` environment variable when executing a build to enable Builder's debug mode. ```bash # Debug development environment DEBUG=builder pnpm dev # Debug production environment DEBUG=builder pnpm build ``` In debug mode, B...
6,821
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/debug/inspector.md
# Using Webpack Inspector Builder has a built-in [webpack inspector](https://github.com/web-infra-dev/webpack-inspector) to debug webpack. ## Introduction The internal workflow of webpack is relatively black box, when using webpack, we often encounter the following problems: - When using some upper-level frameworks...
6,822
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/faq/exceptions.md
# Exceptions FAQ ### 'compilation' argument error when webpack compiling? If the following error occurs when compiling, it is usually caused by installing the wrong version of webpack in the project, or installing multiple versions of webpack: ```bash TypeError: The 'compilation' argument must be an instance of Comp...
6,823
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/faq/features.md
# Features FAQ ### How to import UI Component library on demand? If you need to configure the on-demand import of the component library, you can configure it through [source.transformImport](/api/config-source.html#sourcetransformimport), which is equivalent to [babel-plugin-import](https://www.npmjs.com/package/babe...
6,824
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/faq/general.md
# General FAQ ### The relationship between Modern.js Builder and Modern.js? The building abilities of Modern.js are based on Modern.js Builder. When developing Modern.js, we designed Builder as an independent module, and clearly divided the responsibilities of Builder and Modern.js. Therefore, Builder can be used in...
6,825
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/faq/hmr.md
# HMR FAQ ### How to troubleshooting HMR ineffective issues? There are several possible reasons why HMR may not be work. This document will cover most common causes and provide guidance for troubleshooting. Please refer to the following content for troubleshooting. Before starting the troubleshooting process, it is ...
6,826
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/framework/vue2.mdx
# Build Vue 2 App Although the Modern.js framework is built on React, the underlying Modern.js Builder is not coupled with React. Therefore, you can use Modern.js Builder to build your Vue applications and leverage most of the capabilities provided by Modern.js Builder. In this document, you will learn how to build a...
6,827
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/framework/vue3.mdx
# Build Vue 3 App Although the Modern.js framework is built on React, the underlying Modern.js Builder is not coupled with React. Therefore, you can use Modern.js Builder to build your Vue applications and leverage most of the capabilities provided by Modern.js Builder. In this document, you will learn how to build a...
6,828
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/optimization/build-performance.mdx
# Improve Build Performance Modern.js Builder optimizes build performance by default, but as the project becomes larger, you may encounter some build performance problems. This document provides some optional speed-up strategies, developers can choose some of them to improve the build performance. :::tip 📢 Notice T...
6,829
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/optimization/inline-assets.md
# Inline Static Assets Inline static assets refer to the practice of including the content of a static asset directly in a HTML or JS file, instead of linking to an external file. This can improve the performance of a website by reducing the number of HTTP requests that the browser has to make to load the page. Howev...
6,830
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/optimization/optimize-bundle.md
# Bundle Size Optimization Bundle size optimization is an important part in production environment because it directly affects the user experience of online users. In this document, we will introduce some common bundle size optimization methods in Builder. ## Reduce duplicate dependencies In real projects, there wil...
6,831
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/guide/optimization/split-chunk.md
# Chunk Splitting Practice A great chunk splitting strategy is very important to improve the loading performance of the application. It can make full use of the browser's caching mechanism to reduce the number of requests and improve the loading speed of the application. A variety of chunk splitting strategies are bu...
6,832
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/introduction.md
# Introduce to Plugin Builder provides developers with a lightweight but powerful plugin system to build itself and any other plugins. Developing plugins to change the Builder's behavior and introduce extra features. such as: - Modify config of bundlers. - Resolve and handle new file types. - Modify and compile file ...
6,833
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/list.md
# Overview ## Official Plugins - [@modern-js/builder-plugin-vue](/plugins/plugin-vue.html): Used to build Vue 3 App. - [@modern-js/builder-plugin-vue2](/plugins/plugin-vue2.html): Used to build Vue 2 App. - [@modern-js/builder-plugin-swc](/plugins/plugin-swc.html): Use SWC as the transformer and minimizer to improve ...
6,834
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-esbuild.mdx
# Esbuild Plugin import Esbuild from '@en/shared/esbuild.md'; <Esbuild /> :::tip Recommend using SWC We recommend using SWC to transform and minify code rather than esbuild, because SWC supports more syntaxes, provides better code compression, and the compiled code has better compatibility. Therefore, we recommend ...
6,835
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-image-compress.mdx
# Image Compress Plugin With the image compression plugin, image resources used in the project can be compressed to reduce the size of the artifacts without affecting the visual appearance of the image. ## Quick Start ### Install You can install the plugin with the following command: import { PackageManagerTabs } ...
6,836
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-node-polyfill.mdx
# Node Polyfill Plugin :::tip About Node Polyfill Normally, we don't need to use Node libs on the browser side. However, it is possible to use some Node libs when the code will run on both the Node side and the browser side, and Node Polyfill provides browser versions of polyfills for these Node libs. ::: By using th...
6,837
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-stylus.mdx
# Stylus Plugin Stylus is an Expressive, dynamic and robust CSS preprocessor. This chapter introduces how to use Stylus in Builder. ## Quick Start ### Install You can install the plugin with the following command: import { PackageManagerTabs } from '@theme'; <PackageManagerTabs command="add @modern-js/builder-plu...
6,838
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-swc.mdx
# SWC Plugin import SWC from '@en/shared/swc.md'; <SWC /> ## Usage Scenarios Before using the SWC plugin, please understand the scenarios and limitations of the SWC plugin to determine whether your project is suitable for using it. ### Rspack Scenario If you are already using Rspack as the bundler in your project...
6,839
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-vue.mdx
# Vue Plugin The Vue plugin provides support for building Vue 3 applications. The plugin internally integrates [vue-loader](https://vue-loader.vuejs.org/) and [@vue/babel-plugin-jsx](https://github.com/vuejs/babel-plugin-jsx). ## Quick Start ### Install You can install the plugin with the following command: import...
6,840
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/plugins/plugin-vue2.mdx
# Vue 2 Plugin The Vue 2 plugin provides support for building Vue 2 applications. The plugin internally integrates [vue-loader](https://vue-loader.vuejs.org/) and [@vue/babel-preset-jsx](https://github.com/vuejs/jsx-vue2). ## Quick Start ### Install You can install the plugin with the following command: import { P...
6,841
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/alias.md
Path aliases allow developers to define aliases for modules, making it easier to reference them in code. This can be useful when you want to use a short, easy-to-remember name for a module instead of a long, complex path. For example, if you frequently reference the `src/common/request.ts` module in your project, you ...
6,842
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/builder.md
Refers to the build tool of Modern.js. The goal of Builder is to "reuse the best practices of build tools". Bundlers are low-level, when we build a project based on webpack, we need to fully understand the webpack config and many webpack plugins and loaders, then spend a lot of time to combine them. Builder is out-of...
6,843
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/bundler.md
Refers to module bundlers such as [webpack](https://webpack.js.org/), [Rspack](https://www.rspack.dev/). The main goal of bundlers is to bundle JavaScript, CSS and other files together, and the bundled files can be used in the browser, Node.js or other environments. When bundler processes the Web application, it build...
6,844
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/bundlerChain.md
Bundler chain is a subset of webpack chain, which contains part of the webpack chain API that you can use to modify both webpack and Rspack configuration. Configurations modified via bundler chain will work on both webpack and Rspack builds. Note that the bundler chain only supports modifying the configuration of the ...
6,845
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/cliToolVue.md
## CLI Tool Before you start building a Vue project, you need a CLI tool to provide basic commands. You can use the [CLI tool](/guide/basic/builder-cli) provided by Builder, or you can build your own CLI tool based on Builder's [Node API](/api/builder-core).
6,846
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/deployApp.md
## Deploy the Application After executing `builder build` to build the application, you will get a set of static assets in the `dist` directory. These assets can be deployed to any platform or server. Please note that the default output structure of Builder may not be suitable for all platforms because different plat...
6,847
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/enableSwc.md
First, you need to execute `pnpm run new` to enable the SWC compile: ```bash ? Please select the operation you want: Enable features ? Please select the feature name: Enable SWC Compile ``` After the installation, please register the SWC plugin in the `modern.config.ts` file, then the SWC compilation and compression ...
6,848
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/esbuild.md
[esbuild](https://esbuild.github.io/) is a front-end build tool based on Golang. It has the functions of bundling, compiling and minimizing JavaScript code. Compared with traditional tools, the performance is significantly improved. When minimizing code, compared to webpack's built-in terser minimizer, esbuild has doze...
6,849
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/getBuilderConfig.md
Get the Builder config, this method must be called after the `modifyBuilderConfig` hook is executed. - **Type** ```ts function GetBuilderConfig(): Readonly<BuilderConfig>; ```
6,850
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/getHTMLPaths.md
Get path information for all HTML assets. This method will return an object, the key is the entry name and the value is the relative path of the HTML file in the dist directory. - **Type** ```ts function GetHTMLPaths(): Record<string, string>; ```
6,851
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/getNormalizedConfig.md
Get the normalized Builder config, this method must be called after the `modifyBuilderConfig` hook is executed. Compared with the `api.getBuilderConfig` method, the config returned by this method has been normalized, and the type definition of the config will be narrowed. For example, the `undefined` type of `config.h...
6,852
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/isPluginExists.md
Determines whether a plugin has been registered. - **Type** ```ts function IsPluginExists(pluginName: string): boolean; ```
6,853
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/micro-frontend.md
Micro-frontend (MFE) is an architecture style similar to microservices. It is a composition of multiple independently delivered frontend applications, forming a cohesive whole. MFE decomposes frontend applications into smaller, simpler applications that can be developed, tested, and deployed independently while still a...
6,854
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/module-federation.md
Module Federation (MF) is a feature of Webpack. It allows a JavaScript application to dynamically load code from another application, and in the process, share dependencies. If an application consuming a federated module does not have a dependency needed by the federated code, Webpack will download the missing dependen...
6,855
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/nodeVersion.md
Before getting started, you will need to install [Node.js](https://nodejs.org/), and ensure that your Node.js version is higher than 14.17.6. **We recommend using the LTS version of Node.js 18.** You can check the currently used Node.js version with the following command: ```bash node -v ``` If you do not have Node....
6,856
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onAfterBuild.md
`onAfterBuild` is a callback function that is triggered after running the production build. You can access the build result information via the `stats' parameter: - If the current bundler is webpack, you will get webpack Stats. - If the current bundler is Rspack, you will get Rspack Stats. - **Type** ```ts function ...
6,857
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onAfterCreateCompiler.md
`onAfterCreateCompiler` is a callback function that is triggered after the compiler instance has been created, but before the build process. This hook is called when you run `builder.startDevServer`, `builder.build`, or `builder.createCompiler`. You can access the Compiler instance object through the `compiler` parame...
6,858
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onAfterStartDevServer.md
Called after starting the development server, you can get the port number through the `port` parameter. - **Type** ```ts function OnAfterStartDevServer( callback: (params: { port: number }) => Promise<void> | void, ): void; ```
6,859
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onBeforeBuild.md
`onBeforeBuild` is a callback function that is triggered before the production build is executed. You can access the final configuration array of the underlying bundler through the `bundlerConfigs' parameter: - If the current bundler is webpack, you will get a webpack configuration array. - If the current bundler is R...
6,860
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onBeforeCreateCompiler.md
`onBeforeCreateCompiler` is a callback function that is triggered after the Compiler instance has been created, but before the build process begins. This hook is called when you run `builder.startDevServer`, `builder.build`, or `builder.createCompiler`. You can access the Compiler instance object through the `compiler...
6,861
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onBeforeStartDevServer.md
Called before starting the development server. - **Type** ```ts function OnBeforeStartDevServer(callback: () => Promise<void> | void): void; ```
6,862
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onDevCompileDone.md
Called after each development environment build, you can use `isFirstCompile` to determine whether it is the first build. - **Type** ```ts function OnDevCompileDone( callback: (params: { isFirstCompile: boolean }) => Promise<void> | void, ): void; ```
6,863
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/onExit.md
Called when the process is going to exit, this hook can only execute synchronous code. - **Type** ```ts function OnExit(callback: () => void): void; ```
6,864
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/rspack.md
[Rspack](https://www.rspack.dev/) is a high performance JavaScript bundler based on Rust, with interoperability with the webpack ecosystem, allowing it to be integrated into webpack projects at a low cost while providing better build performance. Compared to webpack, Rspack has significantly improved build performance...
6,865
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/rspackPrecautions.md
## Precautions Before using Rspack, please be aware that Rspack is still an early stage project and is currently in a rapid iteration phase. Therefore, you need to be aware of the following: - The API and configuration options of Rspack are still unstable, and the support for Rspack in Modern.js is experimental. Ther...
6,866
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/rspackTip.mdx
:::tip What is Rspack import Rspack from './rspack.md'; <Rspack /> :::
6,867
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/swc.md
[SWC](https://SWC.rs/) (Speedy Web Compiler) is a transformer and minimizer for JavaScript and TypeScript based on `Rust`. SWC can provide the same abilities with Babel, and it's more than 10x faster than Babel. Modern.js Builder has a out-of-box plugin for SWC, power your Web application with Polyfill and minificatio...
6,868
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/vue2Project.md
## Example Project We have created an example project based on Vue 2 and Modern.js Builder. You can build your own project by referring this project, or just cloning it as a template. The following documentation will provide more detailed instructions. - [modern-js-examples - builder-vue2](https://github.com/web-infr...
6,869
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/en/shared/vue3Project.md
## Example Project We have created an example project based on Vue 3 and Modern.js Builder. You can build your own project by referring this project, or just cloning it as a template. The following documentation will provide more detailed instructions. - [modern-js-examples - builder-vue3](https://github.com/web-infr...
6,870
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/index.md
--- pageType: home hero: name: Modern.js Builder tagline: 基于 Rspack 的 Web 构建工具 actions: - theme: brand text: 介绍 link: /guide/introduction.html - theme: alt text: 快速上手 link: /guide/quick-start.html features: - title: Rust 构建 details: 轻松切换到 Rspack 构建工具,编译飞快。 icon: 🚀 - ...
6,871
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/builder-core.mdx
--- extractApiHeaders: [2] --- # Builder Core 本章节描述了 Builder 提供的一些核心方法。 ## createBuilder 创建一个 Builder 实例对象。 使用该方法时,需要搭配 `@modern-js/builder-webpack-provider` 或 `@modern-js/builder-rspack-provider` 使用,Provider 基于特定 bundler 实现了对应的构建能力。 ### builderWebpackProvider 当传入 `builderWebpackProvider` 时,Builder 会使用 webpack 作...
6,872
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/builder-instance.mdx
--- extractApiHeaders: [2] --- # Builder Instance 本章节描述了 Builder 实例对象上所有的属性和方法。 ## builder.context `builder.context` 是一个只读对象,提供一些上下文信息。 ### builder.context.entry 构建入口对象,对应调用 `createBuilder` 时传入的 `entry` 选项。 - **类型** ```ts type BuilderEntry = Record<string, string | string[]>; ``` ### builder.context.target 构建...
6,873
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/builder-types.mdx
--- extractApiHeaders: [2] --- # Builder Types 本章节描述了 Builder 提供的一些类型定义。 ## BuilderInstance Builder 实例的类型。 ```ts import type { BuilderInstance } from '@modern-js/builder'; let builder: BuilderInstance; ``` 你可以通过泛型来传入 Provider 的类型,使 Builder 实例获得更准确的类型定义: ```ts import type { createBuilder, type BuilderInstance } ...
6,874
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-dev.mdx
--- extractApiHeaders: [2] --- # Dev Config 本章节描述了 Builder 中与本地开发有关的配置。 ## dev.assetPrefix import AssetPrefix from '@zh/config/dev/assetPrefix.md'; <AssetPrefix /> ## dev.beforeStartUrl import BeforeStartUrl from '@zh/config/dev/beforeStartUrl.md'; <BeforeStartUrl /> ## dev.hmr import Hmr from '@zh/config/dev...
6,875
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-experiments.mdx
--- extractApiHeaders: [2] --- # Experiments Config 本章节描述了 Builder 中的一些实验性配置,实验性配置可以开启 Builder 中尚未稳定的功能。 如果你在使用实验性功能时遇到问题,请先关闭对应的配置,并通过 [GitHub Issues](https://github.com/web-infra-dev/modern.js/issues) 进行反馈。 ## experiments.lazyCompilation import LazyCompilation from '@zh/config/experiments/lazyCompilation.md'; <...
6,876
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-html.mdx
--- extractApiHeaders: [2] --- # Html Config 本章节描述了 Builder 中与 HTML 有关的配置。 ## html.appIcon import AppIcon from '@zh/config/html/appIcon.md'; <AppIcon /> ## html.crossorigin import Crossorigin from '@zh/config/html/crossorigin.md'; <Crossorigin /> ## html.disableHtmlFolder import DisableHtmlFolder from '@zh/co...
6,877
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-output.mdx
--- extractApiHeaders: [2] --- # Output Config 本章节描述了 Builder 中与构建产物有关的配置。 ## output.assetPrefix import AssetPrefix from '@zh/config/output/assetPrefix.md'; <AssetPrefix /> ## output.assetsRetry import AssetsRetry from '@zh/config/output/assetsRetry.md'; <AssetsRetry /> ## output.charset import Charset from '...
6,878
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-performance.mdx
--- extractApiHeaders: [2] --- # Performance Config 本章节描述了 Builder 中与性能有关的配置。 ## performance.buildCache import BuildCache from '@zh/config/performance/buildCache.md'; <BuildCache /> ## performance.bundleAnalyze import BundleAnalyze from '@zh/config/performance/bundleAnalyze.md'; <BundleAnalyze /> ## performanc...
6,879
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-security.mdx
--- extractApiHeaders: [2] --- # Security Config 本章节描述了 Builder 中与安全有关的配置。 ## security.sri import Sri from '@zh/config/security/sri.md'; <Sri /> ## security.checkSyntax import CheckSyntax from '@zh/config/security/checkSyntax.md'; <CheckSyntax />
6,880
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-source.mdx
--- extractApiHeaders: [2] --- # Source Config 本章节描述了 Builder 中与源代码解析、编译方式相关的配置。 ## source.alias import Alias from '@zh/config/source/alias.md'; <Alias /> ## source.aliasStrategy import AliasStrategy from '@zh/config/source/aliasStrategy.md'; <AliasStrategy /> ## source.include import Include from '@zh/config...
6,881
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/config-tools.mdx
--- extractApiHeaders: [2] --- # Tools Config 本章节描述了 Builder 中与底层工具有关的配置。 ## tools.autoprefixer import Autoprefixer from '@zh/config/tools/autoprefixer.md'; <Autoprefixer /> ## tools.babel import Babel from '@zh/config/tools/babel.md'; <Babel /> ## tools.bundlerChain import BundlerChain from '@zh/config/tools...
6,882
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/index.mdx
--- overview: true --- # API
6,883
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/plugin-core.mdx
--- extractApiHeaders: [2] --- # Plugin Core 本章节描述了 Builder 插件核心的类型定义和 API。 ## BuilderPlugin 插件对象的类型,插件对象包含以下属性: - `name`:插件的名称,唯一标识符。 - `setup`:插件逻辑的主入口函数,可以是一个异步函数。该函数仅会在初始化插件时执行一次。 - `pre`:指定当前插件的前置插件有哪些,可以传入前置插件 name 的数组,当前插件会被调整到这些插件之后执行。 - `post`:指定当前插件的后置插件有哪些,可以传入后置插件 name 的数组,当前插件会被调整到这些插件之前执行。 - `remove`...
6,884
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/api/plugin-hooks.mdx
--- extractApiHeaders: [2] --- # Plugin Hooks 本章节描述了 Builder 插件提供的生命周期钩子。 ## 概览 **通用钩子** - `modifyBuilderConfig`:修改传递给 Builder 的配置项。 - `modifyBundlerChain` (实验性):通过 chain api 修改 webpack / Rspack 配置。 - `modifyWebpackChain`:修改 webpack chain 配置。 - `modifyWebpackConfig`:修改最终的 webpack 配置对象。 - `modifyRspackConfig`:修改最终的...
6,885
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/assetPrefix.md
- **类型:** `boolean | string` - **默认值:** `'/'` 设置开发环境下的静态资源 URL 前缀。 `assetPrefix` 会影响构建产物中绝大部分静态资源的 URL,包括 JavaScript 文件、CSS 文件、图片、视频等。如果指定了一个错误的值,则在加载这些资源时可能会出现 404 错误。 该配置项仅用于开发环境。在生产环境下,请使用 `output.assetPrefix` 配置项进行设置。 ### Boolean 类型 如果设置 `assetPrefix` 为 `true`,Builder 会使用 `http://localhost:port/` 作为 URL 前缀: `...
6,886
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/beforeStartUrl.md
- **类型:** `() => Promise<void> | void` - **默认值:** `undefined` `dev.beforeStartUrl` 用于在打开 `startUrl` 前执行一段回调函数,该配置项需要与 `dev.startUrl` 一同使用。 ```js export default { dev: { startUrl: true, beforeStartUrl: async () => { await doSomeThing(); }, }, }; ```
6,887
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/hmr.md
- **类型:** `boolean` - **默认值:** `true` 是否开启 Hot Module Replacement 热更新能力。 当 `hmr` 设置为 `false` 时,将不再提供热更新和 react-refresh 功能。 ```js export default { dev: { hmr: false, }, }; ```
6,888
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/host.md
- **类型:** `string` - **默认值:** `0.0.0.0` 指定 dev server 启动时监听的 host。 默认情况下,dev server 会监听 `0.0.0.0`,这代表监听所有的网络接口,包括 `localhost` 和公网地址。 如果你希望 dev server 只监听 `localhost`,可以设置为: ```ts export default { dev: { host: 'localhost', }, }; ```
6,889
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/https.md
- **类型:** `boolean | { key: string; cert: string }` - **默认值:** `false` 配置该选项后,可以开启 Dev Server 对 HTTPS 的支持,同时会禁用 HTTP 服务器。 开启前: ```bash > Local: http://localhost:8080/ > Network: http://192.168.0.1:8080/ ``` 开启后: ```bash > Local: https://localhost:8080/ > Network: https://192.168.0.1:8080/ ``` ####...
6,890
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/port.md
- **类型:** `number` - **默认值:** `8080` 设置 Dev Server 监听的端口号。 默认情况下,Dev Server 会监听 8080 端口,并在端口被占用时自动递增端口号。 ### 示例 将端口设置为 `3000`: ```ts export default { dev: { port: 3000, }, }; ```
6,891
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/progressBar.md
- **类型:** ```ts type ProgressBar = | boolean | { id?: string; }; ``` - **默认值:** `true` 是否在编译过程中展示进度条。 ```js export default { dev: { progressBar: false, }, }; ``` 如果需要修改进度条左侧显示的文本内容,可以设置 `id` 选项: ```ts export default { dev: { progressBar: { id: 'Some Text', }, }, }; ```
6,892
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/dev/startUrl.md
- **类型:** `boolean | string | string[] | undefined` - **默认值:** `undefined` `dev.startUrl` 用于设置 Dev Server 启动时自动在浏览器中打开的页面 URL。 默认情况下,Dev Server 启动时不会打开任何页面。 你可以设置为如下的值: ```js export default { dev: { // 打开项目的默认页面,等价于 `http://localhost:<port>` startUrl: true, // 打开指定的页面 startUrl: 'http://localhost:8...
6,893
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/experiments/lazyCompilation.md
- **类型:** ```ts type LazyCompilationOptions = | boolean | { // 是否为异步模块开启延迟编译 imports?: boolean; // 是否为入口模块开启延迟编译 entries?: boolean; }; ``` - **默认值:** `false` - **打包工具:** `仅支持 webpack` 用于开启延迟编译(即按需编译)的能力。当开启此配置项时,Builder 会进行延迟编译,提升项目的编译启动速度。 延迟编译只在开发环境下生效。 ### 延迟编译异步模块 延迟编译 [dynamic...
6,894
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/experiments/sourceBuild.md
- **类型:** `boolean` - **默认值:** `false` - **打包工具:** `仅支持 webpack` - **版本:** `MAJOR_VERSION.26.0` 用于开启源码构建的能力。当开启此配置项时,Builder 会读取子项目 package.json 的 `source` 字段对应的源码文件,并进行编译。 ```ts export default { experiments: { sourceBuild: true, }, }; ``` 更多信息可参考[「进阶-源码构建模式」](https://modernjs.dev/builder/guide/advanced/sour...
6,895
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/html/appIcon.md
- **类型:** `string` - **默认值:** `undefined` 设置 iOS 系统下的 apple-touch-icon 图标的文件路径,可以设置为相对于项目根目录的相对路径,也可以设置为文件的绝对路径。暂不支持设置为 CDN URL。 配置该选项后,在编译过程中会自动将图标拷贝至 dist 目录下,并在 HTML 中添加相应的 `link` 标签。 ### 示例 设置为相对路径: ```js export default { html: { appIcon: './src/assets/icon.png', }, }; ``` 设置为绝对路径: ```js import path ...
6,896
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/html/crossorigin.md
- **类型:** `boolean | 'anonymous' | 'use-credentials'` - **默认值:** `false` 用于设置 `<script>` 和 `<style>` 标签的 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性。 - 当传入 `true` 时,它会被自动设置为 `crossorigin="anonymous"`。 - 当传入 `false` 时,它不会设置 `crossorigin` 属性。 ### 示例 ```js export default ...
6,897
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/html/disableHtmlFolder.md
- **类型:** `boolean` - **默认值:** `false` 移除 HTML 产物对应的文件夹。开启该选项后,生成的 HTML 文件目录会从 `[name]/index.html` 变为 `[name].html`。 ### 示例 默认情况下,HTML 产物在 `dist` 目录下的结构为: ```bash /dist └── html └── main └── index.html ``` 开启 `html.disableHtmlFolder` 配置: ```js export default { html: { disableHtmlFolder: true, ...
6,898
0
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config
petrpan-code/web-infra-dev/modern.js/packages/document/builder-doc/docs/zh/config/html/favicon.md
- **类型:** `string` - **默认值:** `undefined` 设置页面的 favicon 图标,可以设置为: - URL 地址。 - 文件的绝对路径。 - 相对于项目根目录的相对路径。 配置该选项后,在编译过程中会自动将图标拷贝至 dist 目录下,并在 HTML 中添加相应的 `link` 标签。 ### 示例 设置为相对路径: ```js export default { html: { favicon: './src/assets/icon.png', }, }; ``` 设置为绝对路径: ```js import path from 'path'; export def...
6,899