Skip to content

Conversation

@jedisct1
Copy link

Change summary

Validate JavaScript toolchains before attempting a build, catching common setup issues early and providing accurate error messages instead of build failures.

As Bun becomes increasingly popular, it’s not ideal to ask users to install Node when they already have Bun. So, this PR also adds proper support for Bun as an alternative runtime.

The verification detects whether a project uses Node.js or Bun by checking for lockfiles, with support for Bun workspaces where the lockfile lives at the workspace root rather than in the subpackage.

When something is missing, the error message now explains exactly what's wrong and how to fix it, whether that's installing a runtime, running npm install, or adding the @fastly/js-compute package.
All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  • Does your submission pass tests?

Changes to Core Features:

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

User Impact

Use get better guidance and can use Bun as an alternative Runtime.

Are there any considerations that need to be addressed for release?

No breaking changes.

Validate JavaScript toolchains before attempting a build, catching
common setup issues early and providing accurate error messages
instead of build failures.

As Bun becomes increasingly popular, it’s not ideal to ask users
to install Node when they already have Bun. So, this PR also adds
proper support for Bun as an alternative runtime.

The verification detects whether a project uses Node.js or Bun by
checking for lockfiles, with support for Bun workspaces where the
lockfile lives at the workspace root rather than in the subpackage.

When something is missing, the error message now explains exactly
what's wrong and how to fix it, whether that's installing a runtime,
running npm install, or adding the @fastly/js-compute package.
@jedisct1 jedisct1 requested a review from a team as a code owner January 27, 2026 09:51
@jedisct1 jedisct1 requested a review from kpfleming January 27, 2026 09:51
Copy link
Contributor

@kpfleming kpfleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some comments for now, overall this looks like a nice improvement. I'll ask @harmony7 to also review this since he's our JavaScript runtime expert.


usesWebpack, err := j.checkForWebpack()
if err != nil {
// Only verify toolchain when using default build (no custom [scripts.build])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be an issue, since most (possibly all) of our JavaScript starter kits include a scripts.build property, and that means users using those starter kits won't benefit from any of this verification logic.

It may be possible to do the verification even if scripts.build is set, as long as its value is exactly npm run build which is what we have in the starter kits.


Verify: npm --version

Then retry: fastly compute build`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In each case where a 'retry' suggestion is provided we may need to do something more complicated, because the user may not have run fastly compute build - they may have run fastly compute publish or fastly compute serve, both of which internally run fastly compute build.

- feat(service/ratelimit): moved the `rate-limit` commands under the `service` command, with an unlisted and deprecated alias of `rate-limit` ([#1632](https://github.com/fastly/cli/pull/1632))
- feat(compute/build): Remove Rust version restriction, allowing 1.93.0 and later versions to be used. ([#1633](https://github.com/fastly/cli/pull/1633))
- feat(service/resourcelink): moved the `resource-link` commands under the `service` command, with an unlisted and deprecated alias of `resource-link` ([#1635](https://github.com/fastly/cli/pull/1635))
- feat(compute/build): improved error messaging for JavaScript builds with pre-flight toolchain verification including Bun runtime support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the PR link to this line, following the example of the other CHANGELOG lines.

@kpfleming kpfleming requested a review from harmony7 January 27, 2026 14:05
@jedisct1 jedisct1 marked this pull request as draft January 28, 2026 16:21
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