这是indexloc提供的服务,不要输入任何密码
Skip to content

Correct usage of define flag? #440

@OmgImAlexis

Description

@OmgImAlexis

What is the correct command to set process.platform='linux'?

$ NODE_ENV=production npx tsup ./x.ts --define.process.platform linux --minify
 CLI  Building entry: ./x.ts
 CLI  tsup v5.4.1
 CLI  Target: node12
 CJS  Build start
 > error: Invalid define value (must be valid JSON syntax or a single identifier): [object Object]

 CJS  Build failed
Error: Build failed with 1 error:
error: Invalid define value (must be valid JSON syntax or a single identifier): [object Object]
    at failureErrorWithLog (/home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:1493:15)
    at /home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:1151:28
    at runOnEndCallbacks (/home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:941:63)
    at buildResponseToResult (/home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:1149:7)
    at /home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:1258:14
    at /home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/home/xo/.npm/_npx/7d72304e626f8399/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (node:events:394:28)
    at addChunk (node:internal/streams/readable:312:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions