Skip to content

Respect conditions arg from node #11838

Open
@sxzz

Description

@sxzz

Describe the bug feature (it's a feature I guess)

Context: Resolving external deps in vite.config.ts

conditions: [],
overrideConditions: ['node'],

conditions is always empty, but we can specify a value via node --conditions=dev or NODE_OPTIONS='--conditions=dev' node.

Suggested solution

I suggest that we should read both process.env and process.execArgv, and parse & merge them. It's a bit complex because there are tons of options in Node (and V8).

Alternative

Or we can just use a Regex to match it.

// 3 cases
node --conditions=dev
node --conditions dev
node -C dev

Therefore, I wonder if there is a better solution can this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions