Skip to content

支持 node18 #173

@liaoyu

Description

@liaoyu

当前 node18 已经设置为 LTS,而 node12 去年 4 月已停止维护,详情见 https://github.com/nodejs/Release

对 builder 的影响

由 v16 升级至 v18 比如大的 breaking change 是 OpenSSL 3.0 里 md4 哈希算法默认不可用,这个算法在 webpack 生态又用到较多,这个问题会提示错误:Error: error:0308010C:digital envelope routines::unsupported

https://nodejs.org/en/blog/release/v17.0.0
https://nodejs.org/en/blog/release/v18.0.0

相关讨论:
webpack/webpack#14532
https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

升级方案

  1. https://github.com/qiniu/builder/releases/tag/v2.7.0 以后的版本可通过设置 node 环境变量使用
NODE_OPTIONS=--openssl-legacy-provider fec-builder -p 8080

# 或者设置全局变量
export NODE_OPTIONS=--openssl-legacy-provider
fec-builder -p 8080
  1. 需升级各依赖库
  • 升级至最新的 webpack,最新 webpack 又依赖 typescript 5,直接或间接依赖升级之后又要求大于 node12 版本,所以计划在 3.0 版本处理

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions