Skip to content

Always include either development or production in exportConditions #1819

@benmccann

Description

@benmccann
  • Rollup Plugin Name: @rollup/plugin-node-resolve
  • Rollup Plugin Version: 15.3.0

Expected Behavior / Situation

It would be nice if exportConditions always included development or production

vite build will automatically set the production condition while vite dev will automatically set the development condition

References:
https://vite.dev/config/shared-options#resolve-conditions
https://vite.dev/guide/env-and-mode#node-env-and-modes

Libraries like Svelte rely on this for tree-shaking out parts of its bundle or returning different modules based on the value. This works automatically in Vite, but requires extra configuration in Rollup

Actual Behavior / Situation

exportConditions is empty by default

Modification Proposal

If the user has not provided either production or development then set production if NODE_ENV is undefined or production and development otherwise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions