parcel-bundler/parcel

Add support for `import { platform } from "process"`

开放

#8,033 创建于 2022年4月30日

 (3 条评论) (0 个反应) (0 位负责人)JavaScript (2,274 个派生)batch import
:raising_hand_woman: FeatureGood First Issue

仓库指标

星标
 (44,030 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

🙋 feature request

I'm trying to bundle ansi-colors for the web, which references process.platform.

Tthis is currently not supported, which means a Node.JS import statement is currently left behind in web-targeted output:

import{platform as e}from"process";

🤔 Expected Behavior

The bundler should perform static analysis on process.platform properties and resolve expressions at compile-time - similar to how process.env gets resolved, perhaps even reusing the same code.

🔦 Context

#7904 was recently resolved and received an enhancement to better support ansi-colors, but didn't get all the way there.

💻 Example

See this project for reference.

贡献者指南