Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ReturnTmp opened this issue Oct 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ReturnTmp
Copy link

问题描述

执行 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 大小限制

依赖版本

  • node.js: v18.17.0
  • @vuepress: v1.9.9
  • vuepress-theme-vdoing: v1.12.9

补充说明(可选)

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

@ReturnTmp ReturnTmp added the bug Something isn't working label Oct 5, 2023
@ReturnTmp ReturnTmp changed the title [bug]: [bug]: [BABEL] Note: The code generator has deoptimised the styling of ... as it exceeds the max of 500KB Oct 5, 2023
@ReturnTmp
Copy link
Author

ReturnTmp commented Oct 13, 2023

我做了如下尝试
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant