Skip to content

A mistake in the config setup (caused by consolidation of __SVELTEKIT_DEV__) #15632

@Vooord

Description

@Vooord

Describe the bug

I found a potential mistake in 2.36.2 => 2.36.3 (commit hash: 8cf71f05b8600e6c4f050316a24aa8d39fb12179). There was an idea to consolidate the DEV and __SVELTEKIT_DEV__ vars. __SVELTEKIT_DEV__ was simply removed, probably assuming it's the same thing as DEV. But actually it's not 😁

Reproduction

The problem lies in the definition of those vars.
As I understand from the esm-env lib: DEV = NODE_ENV !== 'production'
Whereas __SVELTEKIT_DEV__ is defined in packages/kit/src/exports/vite/index.js:375 and it's eventually __SVELTEKIT_DEV__ = !is_build.

That was the reason why my project was making a broken build when building for staging. Previously the staging build had __SVELTEKIT_DEV__ as false, but the DEV is true now in the same case (as I mentioned before, DEV = NODE_ENV !== 'production')

I didn't dig deeper for the particular line of code that caused a problem for me, but I can see many config options that depend on __SVELTEKIT_DEV__. So the fact that they all work differently now should potentially lead to errors.

Logs

System Info

System:
    OS: macOS 26.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 269.84 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.16.0 - /usr/local/bin/node
    npm: 10.9.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 146.0.7680.177
    Safari: 26.2
  npmPackages:
    @sveltejs/adapter-static: 3.0.8 => 3.0.8 
    @sveltejs/kit: 2.50.0 => 2.50.0 
    @sveltejs/vite-plugin-svelte: 5.1.1 => 5.1.1 
    svelte: 5.14.4 => 5.14.4 
    vite: 6.3.6 => 6.3.6

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions