Version: 4.6.0
Environment: Browser (Vite / any non-webpack bundler)
Problem
build/cjs/chunk-D5BXCJ5G.mjs (and build/cjs/Draggable.js) ship a raw process.env.DRAGGABLE_DEBUG reference that is never replaced at build time:
// log.ts → chunk-D5BXCJ5G.mjs:343
if (process.env.DRAGGABLE_DEBUG) console.log(...args);
process is a Node.js global. Bundlers like Vite do not inject it into browser bundles, so any app that imports react-draggable crashes on load with:
ReferenceError: process is not defined
at log (chunk-D5BXCJ5G.mjs:343)
at getDerivedStateFromProps (chunk-D5BXCJ5G.mjs:759)
...
This is a regression — prior releases did not reference process.env in the browser bundle.
Expected behaviour
The published browser bundle should not reference process.env. Either:
- replace the reference at build time (e.g.
if (false) in the dist), or
- use
typeof process !== 'undefined' && process.env.DRAGGABLE_DEBUG as a guard.
Workaround
Add a define entry in vite.config.ts to stub the variable:
define: {
"process.env.DRAGGABLE_DEBUG": JSON.stringify(process.env.DRAGGABLE_DEBUG ?? false),
},
This is a consumer-side workaround and should not be required.
Version: 4.6.0
Environment: Browser (Vite / any non-webpack bundler)
Problem
build/cjs/chunk-D5BXCJ5G.mjs(andbuild/cjs/Draggable.js) ship a rawprocess.env.DRAGGABLE_DEBUGreference that is never replaced at build time:processis a Node.js global. Bundlers like Vite do not inject it into browser bundles, so any app that imports react-draggable crashes on load with:This is a regression — prior releases did not reference
process.envin the browser bundle.Expected behaviour
The published browser bundle should not reference
process.env. Either:if (false)in the dist), ortypeof process !== 'undefined' && process.env.DRAGGABLE_DEBUGas a guard.Workaround
Add a
defineentry invite.config.tsto stub the variable:This is a consumer-side workaround and should not be required.