Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "shims: true" on Windows #844

Closed
ghostdevv opened this issue Feb 22, 2023 · 4 comments · Fixed by #891
Closed

Issue with "shims: true" on Windows #844

ghostdevv opened this issue Feb 22, 2023 · 4 comments · Fixed by #891
Labels

Comments

@ghostdevv
Copy link

ghostdevv commented Feb 22, 2023

I added CI for a project using the latest version of tsup-node (6.6.3) and when I build I get the following error:

Error: s/jellycommands build: X [ERROR] The injected path "D:\\a\\jellycommands\\jellycommands\\node_modules\\.pnpm\\tsup@6.6.3_typescript@4.9.5\\node_modules\\tsup\\assets\\esm_shims.js" cannot be marked as external
Error: s/jellycommands build: X [ERROR] The injected path "D:\\a\\jellycommands\\jellycommands\\node_modules\\.pnpm\\tsup@6.6.3_typescript@4.9.5\\node_modules\\tsup\\assets\\cjs_shims.js" cannot be marked as external
Full Error Message
packages/jellycommands build$ tsup-node
packages/jellycommands build: CLI Building entry: src/index.ts
packages/jellycommands build: CLI Using tsconfig: tsconfig.json
packages/jellycommands build: CLI tsup v6.6.3
packages/jellycommands build: CLI Using tsup config: D:\a\jellycommands\jellycommands\packages\jellycommands\tsup.config.ts
packages/jellycommands build: CLI Target: esnext
packages/jellycommands build: CLI Cleaning output folder
packages/jellycommands build: ESM Build start
packages/jellycommands build: CJS Build start
Error: s/jellycommands build: X [ERROR] The injected path "D:\\a\\jellycommands\\jellycommands\\node_modules\\.pnpm\\tsup@6.6.3_typescript@4.9.5\\node_modules\\tsup\\assets\\esm_shims.js" cannot be marked as external
Error: s/jellycommands build: X [ERROR] The injected path "D:\\a\\jellycommands\\jellycommands\\node_modules\\.pnpm\\tsup@6.6.3_typescript@4.9.5\\node_modules\\tsup\\assets\\cjs_shims.js" cannot be marked as external
packages/jellycommands build: CJS Build failed
packages/jellycommands build: Error: Build failed with 1 error:
packages/jellycommands build: error: The injected path "D:\\a\\jellycommands\\jellycommands\\node_modules\\.pnpm\\tsup@6.6.3_typescript@4.9.5\\node_modules\\tsup\\assets\\cjs_shims.js" cannot be marked as external
packages/jellycommands build:     at failureErrorWithLog (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:1636:15)
packages/jellycommands build:     at D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:1048:25
packages/jellycommands build:     at runOnEndCallbacks (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:1471:45)
packages/jellycommands build:     at buildResponseToResult (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:1046:7)
packages/jellycommands build:     at D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:1075:16
packages/jellycommands build:     at responseCallbacks.<computed> (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:697:9)
packages/jellycommands build:     at handleIncomingPacket (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:752:9)
packages/jellycommands build:     at Socket.readFromStdout (D:\a\jellycommands\jellycommands\node_modules\.pnpm\esbuild@0.17.10\node_modules\esbuild\lib\main.js:673:7)
packages/jellycommands build:     at Socket.emit (node:events:513:28)
packages/jellycommands build:     at addChunk (node:internal/streams/readable:324:[12](https://github.com/ghostdevv/jellycommands/actions/runs/4247263100/jobs/7385097518#step:6:13))
packages/jellycommands build: ESM Build failed
packages/jellycommands build: DTS Build start
packages/jellycommands build: DTS ⚡️ Build success in 3581ms
packages/jellycommands build: DTS dist\index.d.ts [14](https://github.com/ghostdevv/jellycommands/actions/runs/4247263100/jobs/7385097518#step:6:15).[24](https://github.com/ghostdevv/jellycommands/actions/runs/4247263100/jobs/7385097518#step:6:25) KB
packages/jellycommands build: Failed

I haven't been able to figure out what is wrong here, I even tried with a stripped down version of my config:

import type { Options } from 'tsup';

export const tsup: Options = {
    // splitting: false,
    // sourcemap: false,
    // clean: true,
    // dts: true,
    // keepNames: true,
    // target: 'esnext',
    // format: ['esm', 'cjs'],
    entryPoints: ['src/index.ts'],
    shims: true,
};

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@ghostdevv
Copy link
Author

It's important to note this only occurs on windows

@psulek
Copy link

psulek commented Feb 28, 2023

Im experiencing same error on windows. When i use tsup and not tsup-node everying works fine.

@hyrious
Copy link

hyrious commented Mar 5, 2023

This happens because tsup-node marks all package-like names as external, where it just assumes paths not starting with ., / are package names.

So C:/abc is treated as a package name here. A quick solution is changing that regex to include ^[a-zA-Z]:.

@github-actions
Copy link

🎉 This issue has been resolved in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants