facebookexperimental / Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
https://recoiljs.org/
MIT License
19.6k stars 1.19k forks source link

Selector throws an error on build version #118

Closed philohelp closed 4 years ago

philohelp commented 4 years ago

Hello Thanks for the great job, I really like recoil. Although the todo list example code works fine in development mode, adding the selectors makes the app crash in production version. I made a repo to show what it does : https://github.com/philohelp/recoil-todos

git clone https://github.com/philohelp/recoil-todos recoil-todos
cd recoil-todos
yarn global add serve
serve -s build
Capture d’écran 2020-05-20 à 02 17 53

How is it possible to fix this ?

davidmccabe commented 4 years ago

There's a bug in the "terser" build step that we're using for the build which causes it to output invalid code. We've seen several problems because of this. In the meantime please use the development bundle, and we are looking into alternatives to terser that may be more correct (suggestions welcome on this). I'm very sorry for the inconvenience. Thanks for reporting this issue.