14islands / r3f-scroll-rig

A react-three-fiber scroll-rig for syncing 3D meshes and DOM elements.
MIT License
720 stars 36 forks source link

process is not defined #14

Closed seantai closed 1 year ago

seantai commented 1 year ago

Uncaught ReferenceError: process is not defined

I've been trying to test this library but running into above error when I

any tips to move forward appreciated

CodyJasonBennett commented 1 year ago

Looks like the ESM bundle of this library is shipping CJS code untranspiled. This specific error comes from the entrypoint of React which is used to load the correct bundle. R3F also does this but has a separate ESM target, React does not.

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

Looking into a fix, but I'd suggest this library use Vite which handles these kinds of headaches wonderfully.

ffdead commented 1 year ago

Seems like it was an old prop-types import that was bundling in that process.env check.

I removed it and it seemed to have fixed the issue (and made the bundle smaller).

@seantai please try v8.9.2+

ffdead commented 1 year ago

Closing due to inactivity