Closed
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
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, notprocess.env.NODE_ENV === 'development'
@mdx-js/rollup
: Support Viteenv.mode
@mdx-js/node-loader
: Use thedevelopment
exports condition inpackage.json
to enable development mode.@mdx-js/register
: Use thedevelopment
exports condition inpackage.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. 🤷