wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.18k stars 31 forks source link

Can't run airtable library #850

Closed taimursaeed closed 1 year ago

taimursaeed commented 1 year ago

Issue description or question

Is this issue related to Quokka not outputting the expected results of your code?: Yes

The Airtable library is included in the package.json. When I try to include airtable the quokka throws error. The code works in the browser.

Sample code

import Airtable from "airtable";

console.log(Airtable)

Quokka.js Console Output

Cannot read properties of undefined (reading 'bind') 
  ​​​​​at ​​​​​​​​Object.<anonymous>​​​ ​./node_modules/airtable/src/fetch.ts:7​
  ​​​​​at ​​​​​​​​Object.<anonymous>​​​ ​./node_modules/airtable/src/base.ts:4​
  ​​​​​at ​​​​​​​​Object.<anonymous>​​​ ​./node_modules/airtable/src/airtable.ts:1​
  ​​​​​at ​​​​​​​​Object.<anonymous>​​​ ​quokka.js:2

Code editor version

Visual Studio Code v1.74.2

OS name and version

OSX 12.3

ArtemGovorov commented 1 year ago

It looks like you may be using Quokka jsdom plugin (if you are using, then it's printed in the first line of the Quokka console output as jsdom-quokka-plugin or auto-detect:create-react-app), and loading jsdom affects loading the airtable library.

To fix the issue you will need to disable the jsdom-quokka-plugin via Quokka configuration on the project or global level by either removing it from the list of plugins in your config, or if it's auto-detect:create-react-app plugin, then by adding "autoDetect": false to your config file.

taimursaeed commented 1 year ago

Thanks @ArtemGovorov "autoDetect":false solved the issue