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. 🤷
Initial checklist
Problem
I think the
developmentoption 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.mode. (This is already used)mode.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-runtimeor/jsx-dev-runtime.Solution
developmentto false, notprocess.env.NODE_ENV === 'development'@mdx-js/rollup: Support Viteenv.mode@mdx-js/node-loader: Use thedevelopmentexports condition inpackage.jsonto enable development mode.@mdx-js/register: Use thedevelopmentexports condition inpackage.jsonto enable development mode.This means Rollup, esbuild, and direct users of
@mdx-js/mdxneed to specifydevelopment: trueexplicitly.Alternatives
Keep it as-is. 🤷