Skip to content

问题:开启 sentry 配置,导致构建内存泄漏

image.png

默认构建配置 使用1个Worker,内存限制为2048MB

image.png

处理方式:

typescript
// Modifying node memory limits
export NODE_OPTIONS="--max-old-space-size=8192"

// 或者修改 SourceMap 生成方式(最低成本)
// https://v3.umijs.org/zh-CN/guide/boost-compile-speed#调整-sourcemap-生成方式

const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = {
  configureWebpack: config => {
    // get a reference to the existing ForkTsCheckerWebpackPlugin
    const existingForkTsChecker = config.plugins.filter(p => p instanceof ForkTsCheckerWebpackPlugin)[0];

    // remove the existing ForkTsCheckerWebpackPlugin
    // so that we can replace it with our modified version
    config.plugins = config.plugins.filter(p => !(p instanceof ForkTsCheckerWebpackPlugin));

    // copy the options from the original ForkTsCheckerWebpackPlugin
    // instance and add the memoryLimit property
    const forkTsCheckerOptions = existingForkTsChecker.options;
    // modification the workers
    forkTsCheckerOptions.workers = 2;
    // modification the memoryLimit
    forkTsCheckerOptions.memoryLimit = 12288;

    config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions));
  }
};

修改后居然提升了构建速度 Before

image.pngimage.png

Layout Switch

Adjust the layout style of VitePress to adapt to different reading needs and screens.

Expand all
The sidebar and content area occupy the entire width of the screen.
Expand sidebar with adjustable values
Expand sidebar width and add a new slider for user to choose and customize their desired width of the maximum width of sidebar can go, but the content area width will remain the same.
Expand all with adjustable values
Expand sidebar width and add a new slider for user to choose and customize their desired width of the maximum width of sidebar can go, but the content area width will remain the same.
Original width
The original layout width of VitePress

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.

Spotlight

Highlight the line where the mouse is currently hovering in the content to optimize for users who may have reading and focusing difficulties.

ONOn
Turn on Spotlight.
OFFOff
Turn off Spotlight.