Closed jackmurra-rgare closed 1 year ago
By default from CommonJs repos Quokka is using standard-things/esm
module, that adds support for top-level await, etc.
When standard-things/esm
is used, it sometimes works a bit differently from the standard node module resolution. In this case to make it work you may use this:
const axios = require('axios').default
const result = await axios.get('https://wallabyjs.com')
console.log(result) //?
If you would like Quokka to work the exact same way in terms of node module resolution, you may add the stdEsm: false
setting to your Quokka config:
{
...
"stdEsm": false,
}
(for example by creating .quokka
file in the project with the {"stdEsm": false}
content).
Please note that in this case however, the top level await will not work for you anymore, the exact same way it won't work if you run the code via node CLI without Quokka.
Thanks for the help Artem!
Issue description or question
Is this issue related to Quokka not outputting the expected results of your code?: No
Sample code
Quokka.js Console Output
Code editor version
IntelliJ IDE 2023.1.1 Build #IU-231.8770.65
OS name and version
OSX Ventura 13.1 on Intel i7 - work computer also happens in WebStorm on my m2 mac (latest OS) home computer