Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always include either development or production in exportConditions #1819

Closed
benmccann opened this issue Nov 28, 2024 · 0 comments · Fixed by #1823
Closed

Always include either development or production in exportConditions #1819

benmccann opened this issue Nov 28, 2024 · 0 comments · Fixed by #1823

Comments

@benmccann
Copy link
Contributor

benmccann commented Nov 28, 2024

  • 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.

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 a pull request may close this issue.

1 participant