sveltejs / sveltejs/kit

Add back `esbuild` configuration options adapters

Open
#3,733 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-netlify
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

For local and testing builds we use MockServiceWorker for our mocks. There's a Node component to the library so we can mock requests in SSR. However, it uses Node libraries, and esbuild throws an error if the platform is not set to node when we build for production. We want to test our app with a production build so that it's as close to what will actually ship as possible.

Without the esbuild configuration option, there's no way for us to change the platform specifically for test builds.

Describe the proposed solution

An option for configuring the build within adapters.

Alternatives considered

Another possibility would be changing the target/platform based on whether or not it is a "preview" build. Since previewing first requires us to build the app with a separate command, I'm not sure how this could be signaled to the build. Maybe a build flag?

Importance

i cannot use SvelteKit without it

Additional Information

Currently operating off a fork so we can use the latest SvelteKit.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing how adapters invoke the esbuild production build and how build options are passed through; done means an adapter can provide esbuild configuration such as platform=node for test builds without changing production behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.