Open ayyash opened 4 years ago
Hi @ayyash - this is likely an issue with your configuration and maybe related to different module targets for node/browser like you say.
Hard to tell, but perhaps enabling the esModuleInterop
option in your tsconfig's compilerOptions
would help?
When I use @sanity/image-url in my client project, it works fine
and the library used is
lib/browser/image-url.umd.js
. Then I build for angular ssr, and I use the following webpack config:I use angular-cli to build, now the code used on server render is
lib/node/index.js
This errors out with:
ERROR TypeError: image_url_1.default is not a function
At this line
When I remove ".default" it works.
Is this a problem with webpack or some bug? or is it an angular specific issue? can I do something to make the umd bundle instead of the node lib?
Edit more information: the client bundle is created while tsconifg.compilerOptions.module is set to "esnext", the server is created with "commonjs"