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

Shim support for Windows is broken #879

@hiimjasmine00

Description

@hiimjasmine00

When I try to add shims: true to my tsup config, it always results in an error.

For example, this is the output:

CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.7.0
CLI Using tsup config: C:\Users\justi\OneDrive\Desktop\CodeProjects\mock-zlib\tsup.config.json
CLI Target: es2021
CLI Cleaning output folder
ESM Build start
CJS Build start
X [ERROR] The injected path "C:\\Users\\justi\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\tsup@6.7.0_ts-node@10.9.1_typescript@5.0.2\\node_modules\\tsup\\assets\\cjs_shims.js" cannot be marked as external

X [ERROR] The injected path "C:\\Users\\justi\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\tsup@6.7.0_ts-node@10.9.1_typescript@5.0.2\\node_modules\\tsup\\assets\\esm_shims.js" cannot be marked as external

ESM Build failed
Error: Build failed with 1 error:
error: The injected path "C:\\Users\\justi\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\tsup@6.7.0_ts-node@10.9.1_typescript@5.0.2\\node_modules\\tsup\\assets\\esm_shims.js" cannot be marked as external 
    at failureErrorWithLog (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:1636:15)
    at C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:1048:25
    at runOnEndCallbacks (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:1471:45)
    at buildResponseToResult (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:1046:7)
    at C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:1075:16
    at responseCallbacks.<computed> (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:697:9)
    at handleIncomingPacket (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:752:9)
    at Socket.readFromStdout (C:\Users\justi\AppData\Local\pnpm\global\5\.pnpm\esbuild@0.17.13\node_modules\esbuild\lib\main.js:673:7)
    at Socket.emit (node:events:512:28)
    at addChunk (node:internal/streams/readable:324:12)
CJS Build failed
DTS Build start
DTS ⚡️ Build success in 1027ms
DTS dist\index.d.ts 192.00 B

I have tried searching for solutions, even modifying the NON_NODE_MODULE_RE regular expression (As suggested in #844), but to no avail. Is there any way to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions