christopherafbjur / sanity-plugin-icon-picker

MIT License
30 stars 27 forks source link

Compatibility issue with Sanity 3.52.0+ #67

Closed clinejj closed 3 months ago

clinejj commented 4 months ago

After updating our Sanity dependency to 3.52.0, we were no longer able to start the studio in dev mode (sanity dev --host=0.0.0.0). It would show the following error:

Uncaught error: _interopRequireDefault2 is not a function
http://localhost:3333/node_modules/.sanity/vite/deps/sanity-plugin-icon-picker.js?v=d414d840:4862:25
TypeError: _interopRequireDefault2 is not a function
    at node_modules/sanity-plugin-icon-picker/node_modules/xregexp/lib/xregexp.js (http://localhost:3333/node_modules/.sanity/vite/deps/sanity-plugin-icon-picker.js?v=d414d840:4862:25)
    at __require2 (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-AUZ3RYOM.js?v=3e8b93e8:18:50)
    at node_modules/sanity-plugin-icon-picker/node_modules/xregexp/lib/index.js (http://localhost:3333/node_modules/.sanity/vite/deps/sanity-plugin-icon-picker.js?v=d414d840:8665:44)
    at __require2 (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-AUZ3RYOM.js?v=3e8b93e8:18:50)
    at node_modules/sanity-plugin-icon-picker/node_modules/decamelize/index.js (http://localhost:3333/node_modules/.sanity/vite/deps/sanity-plugin-icon-picker.js?v=d414d840:8690:19)
    at __require2 (http://localhost:3333/node_modules/.sanity/vite/deps/chunk-AUZ3RYOM.js?v=3e8b93e8:18:50)
    at http://localhost:3333/node_modules/.sanity/vite/deps/sanity-plugin-icon-picker.js?v=d414d840:8791:33

Looking at the changelog on Sanity, it appears this PR updating how imports work related to their auto-updating functionality may have triggered it: https://github.com/sanity-io/sanity/pull/7187

Either way, would it be possible to address this so we can update to the newer versions of Sanity Studio?

clinejj commented 3 months ago

Actually, it seems this was caused by https://github.com/sanity-io/sanity/pull/7172 where they changed the Vite config to add conditions.

A similar issue was resolved in Storybook here: https://github.com/storybookjs/storybook/pull/28581

I'm talking to Sanity support to see if this is an issue on their side, but it also might be related to how this plugin loads React possibly?

notflip commented 3 months ago

@clinejj Which version was the last one that was working for you? I went back to 3.48.1 and the issue remains there.

clinejj commented 3 months ago

I had it working in 3.51.0

clinejj commented 3 months ago

This should be resolved in sanity 3.52.3+ (see release notes), fixed in this PR: https://github.com/sanity-io/sanity/pull/7267