code-connect
code-connect copied to clipboard
The @figma/code-connect library uses node imports, causes errors in browser storybook with typical polyfills
Importing @figma/code-connect in my storybook story files causes an issue due to node imports it uses in the browser:
TypeError: console_1.Console is not a constructor
at ./node_modules/@figma/code-connect/dist/common/logging.js (http://localhost:6006/vendors-node_modules_figma_code-connect_dist_index_js-node_modules_react-native-web_dist_expo-6c8669.iframe.bundle.js:167:17)
figma -V = 9.6.5
OS: Mac OSX, Sonoma 14.5
storybook = v7.0.24
The console polyfills I attempted to use do not support the new Console() call that is being used in logging.js so I had to change the line indicated above.
Can you recommend a polyfill for webpack 5+ or provide a version of the figma/code-connect without the node imports for use in the storybook imports?