Skip to content

Replace node:utils#styleText with picocolors #1947

Description

@liangmiQwQ

Description

styleText from node:utils is introduced in Node v20.12.0 or v21.7.0. Considering this is imported with an import statement, which happens while resolving modules, it blocks most of old Node version to access Vite+ local (JavaScript) cli.

Since users are allowed to run Vite+ with an incompatible node version, and there are indeed needs to Vite+ with a old node version, optimizing them seems worth doing for a united toolchain.

It doesn't mean old node version should be fully supported even if for ancient ones, this is absolutely not our goal and impossible. We just hope users are still able to access some parts of Vite+, at least not be all blocked when loading imports by a replaceable color library.

Suggested solution

Switch the color library to picocolors, just like what Vite did. It does not have such a strong Node version requirement and can be bundled.

Reference: #1909 (comment)

Metadata

Metadata

Assignees

No one assigned

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions