Skip to content

Remove support for NODE_ENV #2367

Closed
Closed
@remcohaszing

Description

@remcohaszing

Initial checklist

Problem

I think the development option offers useful features, but I don’t think it’s good for a library to output different content based on an environment variable. I do think it’s useful for an integration to leverage a mode to determine what the output looks like.

  • Webpack has mode. (This is already used)
  • Vite has mode.
  • Node.js has conditions.
  • Rollup has no such option as far as I’m aware.
  • ESBuild has no such option as far as I’m aware.

Especially when it comes to MDX on demand I believe it’s good to be explicit about this, because it determines whether the user should use /jsx-runtime or /jsx-dev-runtime.

Solution

  • Default development to false, not process.env.NODE_ENV === 'development'
  • @mdx-js/rollup: Support Vite env.mode
  • @mdx-js/node-loader: Use the development exports condition in package.json to enable development mode.
  • @mdx-js/register: Use the development exports condition in package.json to enable development mode.

This means Rollup, esbuild, and direct users of @mdx-js/mdx need to specify development: true explicitly.

Alternatives

Keep it as-is. 🤷

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions