xugaoyi / vuepress-theme-vdoing

🚀一款简洁高效的VuePress知识管理&博客(blog)主题
https://doc.xugaoyi.com
MIT License
4.49k stars 1.15k forks source link

[bug]: [BABEL] Note: The code generator has deoptimised the styling of ... as it exceeds the max of 500KB #694

Closed ReturnTmp closed 11 months ago

ReturnTmp commented 11 months ago

问题描述

执行 npm run build 打包出现如下问题 [BABEL] Note: The code generator has deoptimised the styling of docs/01.基础课程/05.机器学习/05.机器学习基础-线性代数.md as it exceeds the max of 500KB

重现步骤

  1. 拉取 vuepress-theme-vdoing 仓库,然后执行 npm install
  2. 创建 N 个 MD 文件
  3. 执行 npm run build

初步判断为 md 文件过多,导致超出 babel 大小限制

依赖版本

补充说明(可选)

之前我在 vuepress 官方仓库找了类似的 isssue ,但是该 issue 也没有对应的解决方法 issues 地址:https://github.com/vuejs/vuepress/issues/3003 我尝试使用上面 issue 中提到的方法,无效 尝试将参数 --max_old_space_size 调大,无效

ReturnTmp commented 11 months ago

我做了如下尝试 1.提升服务器配置 2.提高参数 --max_old_space_size (提高到 102400) 3.项目根目录创建 .babelrc 添加 "compact": false

{
 "compact": false,
 "presets": ["env", "react", "stage-0"],
 "plugins": [
 "transform-runtime"
    ]
}

然后执行如下打包命令,最后成功 export NODE_OPTIONS=--openssl-legacy-provider && node --max_old_space_size=102400 ./node_modules/vuepress/cli.js build docs