unjs / unbuild

📦 A unified JavaScript build system
MIT License
2.31k stars 90 forks source link

cannot use stub with `file://` protocol and esno (WSL2) #377

Open MarvinXu opened 6 months ago

MarvinXu commented 6 months ago

Environment

Win 11, WSL2 unbuild@2.0.0

Reproduction

  1. create project following usage in Ubuntu WSL2
  2. run npx unbuild --stub

Describe the bug

Output file dist/index.mjs have incorrect filepath of jiti ( file:// points to Windows file system while the following path is in Linux subsystem)

import jiti from "file:///home/marv/.npm/_npx/97e73b3cab55bb68/node_modules/jiti/lib/index.js";
...

Additional context

No response

Logs

No response

pi0 commented 6 months ago

fixed?

MarvinXu commented 6 months ago

No. I'm just having second thoughts on if it's a bug of this package😂. The output .mjs can be run correctly with command node index.mjs, it just can't be resolved in other projects. image

pi0 commented 6 months ago

it just can't be resolved in other projects.

Okay interesting. It seems esno does not likes import with file:// protocol. /cc @antfu just to be in context.

pi0 commented 6 months ago

(opened to investigate if we can do anything to mitigate this)

MarvinXu commented 6 months ago

BTW, vscode doesn't seem to resolve this path either. I'll have to remove file:// recording