Skip to content

[Bug]: __filename is broken in CJS output #425

@chenjiahan

Description

@chenjiahan

Version

Rslib 0.0.18

Details

  • Input:
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
console.log(__filename);
  • Run dist/index.cjs:

Image

Reproduce link

https://github.com/chenjiahan/rslib-repro-cjs-filename

Reproduce Steps

  1. pnpm i
  2. pnpm run build
  3. node ./dist/index.cjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions