boolean | objectfalseBy setting output.convertToRem, Modern.js can do the following things:
If output.convertToRem is set to true, Rem processing capability will be turned on.
At this point, the rem configuration defaults as follows:
When the value of output.convertToRem is object type, Modern.js will perform Rem processing based on the current configuration.
options:
| Name | Type | Default | Description |
|---|---|---|---|
| enableRuntime | boolean | true | Whether to generate runtime code to calculate and set the font size of the root element |
| inlineRuntime | boolean | true | Whether to inline the runtime code to HTML. If set to false, the runtime code will be extracted into a separate convert-rem.[version].js file and output to the dist directory |
| rootFontSize | number | 50 | The root element font size |
| maxRootFontSize | number | 64 | The root element max font size |
| widthQueryKey | string | '' | Get clientWidth from the url query based on widthQueryKey |
| screenWidth | number | 375 | The screen width for UI design drawings (Usually, fontSize = (clientWidth * rootFontSize) / screenWidth) |
| excludeEntries | string[] | [] | To exclude some page entries from injecting runtime code, it is usually used with pxtorem.exclude |
| supportLandscape | boolean | false | Use height to calculate rem in landscape |
| useRootFontSizeBeyondMax | boolean | false | Whether to use rootFontSize when large than maxRootFontSize |
| pxtorem | object |
| postcss-pxtorem options |
For detailed usage, please refer to rsbuild-plugin-rem.