You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you did:
Installed mdx-bundler and esbuild and ran the example code.
What happened:
❯ node .
✘ [ERROR] Expected value for define "process.env.NODE_ENV" to be a string, got undefined instead
Error: Build failed with 1 error:
error: Expected value for define "process.env.NODE_ENV" to be a string, got undefined instead
at async ESMLoader.import (https://nodesyqie8-xvjd.w-credentialless.staticblitz.com/blitz.6f912e90fcb88a8621a295889b82f338c77531e6.js:6:1209052)
at async i.loadESM (https://nodesyqie8-xvjd.w-credentialless.staticblitz.com/blitz.6f912e90fcb88a8621a295889b82f338c77531e6.js:6:246622)
at async handleMainPromise (https://nodesyqie8-xvjd.w-credentialless.staticblitz.com/blitz.6f912e90fcb88a8621a295889b82f338c77531e6.js:6:989060) {
errors: [
{
id: '',
pluginName: '',
text: 'Expected value for define "process.env.NODE_ENV" to be a string, got undefined instead',
location: null,
notes: [],
detail: Error: Expected value for define "process.env.NODE_ENV" to be a string, got undefined instead
at validateStringValue (file:///home/projects/node-syqie8/node_modules/esbuild/lib/main.js:290:11)
at pushCommonFlags (file:///home/projects/node-syqie8/node_modules/esbuild/lib/main.js:381:37)
at flagsForBuildOptions (file:///home/projects/node-syqie8/node_modules/esbuild/lib/main.js:416:3)
at buildOrServeContinue (file:///home/projects/node-syqie8/node_modules/esbuild/lib/main.js:1008:9)
at eval (file:///home/projects/node-syqie8/node_modules/esbuild/lib/main.js:981:11)
}
],
warnings: []
}
.
If the value undefined is passed to JSON.stringify, it will return the value undefined (see mdn web docs).
But esbuild expects a string instead. This was introduced in v0.16.0, see section "Add additional validation of API parameters" of https://github.com/evanw/esbuild/releases/tag/v0.16.0.
Suggested solution:
Define process.env.NODE_ENV only if it is set.
The text was updated successfully, but these errors were encountered:
* refactor(web): migrate to moduleResolution node16
also revert cec630d because "imports" is not supported well enough yet
* chore(deps): ignore updates for "esbuild"
because of kentcdodds/mdx-bundler#205
mdx-bundlerversion: 9.2.1nodeversion: 16.14.2npmversion: 7.17.0Relevant code or config
The example code from https://github.com/kentcdodds/mdx-bundler#usage.
What you did:
Installed
mdx-bundlerandesbuildand ran the example code.What happened:
Reproduction repository:
https://stackblitz.com/edit/node-syqie8
Problem description:
mdx-bundlerdefines'process.env.NODE_ENV'here, via JSON.stringify:mdx-bundler/src/index.js
Line 179 in f1f4828
If the value
undefinedis passed toJSON.stringify, it will return the valueundefined(see mdn web docs).But
esbuildexpects a string instead. This was introduced in v0.16.0, see section "Add additional validation of API parameters" of https://github.com/evanw/esbuild/releases/tag/v0.16.0.Suggested solution:
Define
process.env.NODE_ENVonly if it is set.The text was updated successfully, but these errors were encountered: