wighawag / sveltejs-adapter-ipfs

Other
23 stars 5 forks source link

utils.copy_static_files is not a function #2

Closed PeterNjeim closed 3 years ago

PeterNjeim commented 3 years ago

TypeError: utils.copy_static_files is not a function at adapt (<project>/node_modules/sveltejs-adapter-ipfs/index.js:17:10)

This occurs when building my project with your adapter with version 0.1.4.

This error also occurs when cloning your demo repo from https://github.com/wighawag/sveltekit-ipfs-demo and running npm i, then npm run build.

image

PeterNjeim commented 3 years ago

Fixed by changing utils.copy_static_files(assets);, utils.copy_client_files(assets);, and await utils.prerender({ to utils.utils.copy_static_files(assets);, utils.utils.copy_client_files(assets);, and await utils.utils.prerender({, respectively.

wighawag commented 3 years ago

Thanks @PeterNjeim and sorry for the late reply (Was away for 2 months) Was it a false issue ? or is the fix still to be included ?

PeterNjeim commented 3 years ago

I'm not sure I understand your comment. Are you asking if this issue is "false" meaning "invalid"? If so, no, since I cloned your demo repo and it simply did not work, without any modifications. As for if it is fixed, yes, I shared the fix right above your reply.

Regardless, I did find a few issues even when using this adapter, some files weren't loading since they were still trying to load from the top level directory and not the IPFS subdirectory, making my website half-functional. So I ended up switching back to adapter-static and just renaming app.html to index.html manually, and telling others to use the dweb.link url instead of ipfs.io, since dweb.link (and some other gateways) actually make subdomains, instead of subdirectories, allowing the website to work fine.

wighawag commented 3 years ago

Was asking since you closed the issue. I am reopening it and I ll look at it later. Indeed, ipfs support in svelte require few more things. you need to use the $base variable to construct your url for example Also it might be that svelete kit is evolving and I need to update some things due to the changes there

wighawag commented 3 years ago

fixed in 0.1.6, thanls @PeterNjeim