solid-orange
solid-orange2y ago

stringify import error

hello, I'm trying the refine tutorial : https://refine.dev/docs/tutorial/understanding-dataprovider/create-dataprovider/ add import as : import { stringify } from "query-string" but some build errors appeared: Compiling... Failed to compile. Attempted import error: 'stringify' is not exported from 'query-string' (imported as 'u'). ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 93:32-33 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 93:40-41 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 107:35-36 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 193:22-23 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 198:20-21 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 200:24-25 export 'stringify' (imported as 'u') was not found in 'query-string' (possible exports: default) ERROR in ./node_modules/@pankod/refine-simple-rest/dist/esm/index.js 230:0-118 export 'stringify' (reexported as 'stringify') was not found in 'query-string' (possible exports: default) webpack compiled with 7 errors ERROR in src/data-provider.ts:23:64 | ^^^
11 Replies
kapa.ai
kapa.ai2y ago
Hey @leoai815! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. It looks like you're running into an issue with the stringify import from query-string. According to the documentation (https://refine.dev/docs/tutorial/understanding-dataprovider/create-dataprovider), you should be importing stringify from query-string like this:
import {{ stringify }} from "query-string";
import {{ stringify }} from "query-string";
If you're still running into issues, you may want to check out the refine troubleshooting guide (https://refine.dev/docs/troubleshooting) for more help. ----------------------
kapa.ai
kapa.ai2y ago
<@1034735462293721088> kapa.ai is still learning and improving, please let us how it did by reacting below
solid-orange
solid-orange2y ago
not working😩
absent-sapphire
absent-sapphire2y ago
Hi @leoai815, can you try npm install query-string@7.1.1 i guess with version 8, some exprots are changed on query-string
solid-orange
solid-orange2y ago
it works, thank you for your reply but there's another issue, after npm run refine swizzle, build fail:Compiled with problems:X ERROR in src/rest-data-provider/index.ts:140:7 TS2322: Type '{ common: Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Accept: AxiosHeaderValue; "User-Agent": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>; ... 9 more ...; unlink?: Partial<...> | undefined; }' is not assignable to type 'HeadersDefaults & { [key: string]: AxiosHeaderValue; }'. Type '{ common: Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Accept: AxiosHeaderValue; "User-Agent": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>; ... 9 more ...; unlink?: Partial<...> | undefined; }' is not assignable to type '{ [key: string]: AxiosHeaderValue; }'. Property 'common' is incompatible with index signature. Type 'Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Accept: AxiosHeaderValue; "User-Agent": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>' is not assignable to type 'AxiosHeaderValue'. Type 'Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Accept: AxiosHeaderValue; "User-Agent": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>' is missing the following properties from type 'string[]': length, pop, push, concat, and 29 more. 138 | 139 | if (headers) {
140 | httpClient.defaults.headers = {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 141 | ...httpClient.defaults.headers, 142 | ...headers, 143 | };
absent-sapphire
absent-sapphire2y ago
we will update documentation. thank you for the issue 🙏
solid-orange
solid-orange2y ago
absent-sapphire
absent-sapphire2y ago
hmm. i will look into it. thank you is your axios version is axios@0.26 ?
solid-orange
solid-orange2y ago
"axios": "^1.3.4",
absent-sapphire
absent-sapphire2y ago
can you install axios@0.26 this pls. simple-rest types compatible with this version but, for refine , axios and query-string veresions is not important. you can use any version with your custom data-provider
solid-orange
solid-orange2y ago
it works. Thanks a lot