Skip to content

source .js files cannot be used as entry points #2037

@boneskull

Description

@boneskull

Search terms

javascript sourcemap source map

Expected Behavior

I expected to be able to define my project entry point as a .js file. I am using TS-style docstrings to document JS sources.

Actual Behavior

It complains the .js file must have a sourceMappingUrl and exits with a non-zero error code

Steps to reproduce the bug

  1. Create a .js file. module.exports = true or smth
  2. Use it as an entry point

Environment

  • Typedoc version: TypeDoc 0.23.10
  • TypeScript version: Using TypeScript 4.7.4 from ./node_modules/typescript/lib
  • Node.js version: v18.4.0
  • OS: macOS

I realize why this happens: TypeDoc expects a .js entry point to be a file compiled by tsc; that's the most common use-case.

To work around this, I use a Babel-compiled .js entry point. That entry point references an external source map which references the original source .js file. TypeDoc seemingly has no problems otherwise generating docs from my JS sources.

I note that inline source maps are apparently not supported; an inline source map causes TypeDoc to attempts to open a file using the source map as a filepath, which throws ENAMETOOLONG 😄

I have no idea what the practical impact would be of just allowing a .js source file as the entry point other than making TypeDoc easier to use for those ornery "types-in-JS" people like myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions