Hi,
I’m a dev for a telehealth startup working on integrating sendbird for video chats I’m hitting a snag. I read the documentation and tried both types of imports.
If I use:
import SendBirdCall from “sendbird-calls”
I get the error:
Attempted import error: ‘sendbird-calls’ does not contain a default export (imported as ‘SendBirdCall’).
I’ve tried adding these settings in my jsconfog.json file:
“allowSyntheticDefaultImports”: true,
“esModuleInterop”: true,
and importing with this:
import * as SendBirdCall from “sendbird-calls”
as suggested by the read me at github (GitHub - sendbird/sendbird-calls-javascript: A guide of Sendbird Calls SDK for JavaScript for an engaging voice and video call experience. ) but that didn’t work either.
Anything thoughts or suggestions?
Thanks,
Dan
Of course I find a solution after posting the this! I just stumbled on a fix so I thought I’d share it.
We’re using craco.js in our app configuration. I started poking around in there and found someone else who had the same issue.
opened 04:13PM - 04 Nov 20 UTC
closed 11:17PM - 11 Dec 20 UTC
First of all, this is a really weird issue and I don't understand how craco is r… elated to it.
I have followed [this tutorial "Using Create-React-App In A Monorepo"](https://medium.com/frontend-digest/using-create-react-app-in-a-monorepo-a4e6f25be7aa).
My goal and config is just made to transpile code from another package.
The moment I launch apps with craco, I am getting `does not contain a default export` for a few libraries, but if they are launched with react-scripts, it does not happen. I really don't understand how that can be related, so I am investigating.
Is there something that craco changes regarding imports or some known issues with lerna/yarn/workspaces?
```js
const path = require('path')
const { getLoader, loaderByName } = require('@craco/craco')
const absolutePath = path.join(__dirname, '../ui-framework')
module.exports = {
webpack: {
alias: {},
plugins: [],
configure: (webpackConfig, { env, paths }) => {
const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'))
if (isFound) {
const include = Array.isArray(match.loader.include)
? match.loader.include
: [match.loader.include]
match.loader.include = include.concat[absolutePath]
}
return webpackConfig
}
}
}
```
The solution was simply this:
“I think it’s include.concat([absolutePath])
with parentheses ”
Hopefully this will save someone some time down the road…
1 Like