Skip to content

Conversation

@harmony7
Copy link
Member

This PR adds an appropriate default export to the package when it is imported (rather than invoked as a CLI command).

@fastly/js-compute doubles as:

  • the compiler CLI invoked using the bin entry js-compute-runtime that resolves to dist/cli/js-compute-runtime-cli.js; and
  • a type library when referenced by TypeScript or IDE using /// <reference types="@fastly/js-compute" />

However, since the main field of package.json also pointed to the CLI entry point until now, it was possible to do a nonsensical import in JavaScript code such as:

import '@fastly/js-compute`;

Although the module exports no members, it would still run the side effects (the executable code in the CLI), printing the help message to stdout.

This PR corrects the behavior by adding an empty index.js file that exports nothing and runs no code. It updates package.json to point the entry point to it using export fields (the modern way of defining entry points), and also updates the legacy main field to point to it as well.

@harmony7 harmony7 requested review from TartanLlama and zkat December 24, 2025 09:21
@harmony7 harmony7 self-assigned this Dec 24, 2025
@TartanLlama TartanLlama changed the title Correct default export fix: Correct default export Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants