1 year ago
#381834
BonisTech
Attempted import error: '@module' does not contain a default export (imported as 'module')
I'm using craco to create a react app. Here are my ts configs:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"downlevelIteration": true
},
"include": [
"src"
]
}
I'm also using a git submodule to import utils from it.
When I run craco start
everything works fine. But when I run craco build
I get this error:
Attempted import error: '@pinata/sdk' does not contain a default export (imported as 'pinataClient')
This is how pinataClient
is imported:
import pinataClient "@pinata/sdk";
When I edit this line to
const pinataClient = require("@pinata/sdk");
Here is the tsconfig
file of the submodule:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"outDir": "dist",
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["./test", "./tasks", "./utils"],
"files": ["./hardhat.config.ts"]
}
I think it is a webpack error, but I can't seem to figure it out.
typescript
webpack
build
create-react-app
craco
0 Answers
Your Answer