Skip to content

naming conflict when importing dynamic/public and /private environment variables #8474

@stephane-vanraes

Description

@stephane-vanraes

Describe the bug

Both dynamic/private and dynamic/public export the variables as env

import { env } from '$env/dynamic/private'; // ok
import { env } from '$env/dynamic/public'; // "env" is already defined !!

It is a bit surprising (to not say disappointing) that this wouldn't work out of the box for an otherwise excellent framework.

Reproduction

NA

Logs

NA

System Info

@sveltejs/kit@1.0.11

Severity

annoyance

Additional Information

Can be easily worked around with:

import { env as pubenv } from '$env/dynamic/public';

(perhaps it is enough to add this example to docs in one of those red boxes ?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions