docusign / docusign-esign-node-client

The Official DocuSign Node.js Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
http://docusign.github.io/docusign-esign-node-client
MIT License
146 stars 100 forks source link

Webpack modules not resolving #232

Open callumcox opened 4 years ago

callumcox commented 4 years ago

Hi,

We're using webpack, to minimize the size of the lambda we've got that consume the DocuSign client and I've had the same problem as https://github.com/docusign/docusign-node-client/issues/214. Digging into the src, looks like it's down to the AMD module resolution and the lack of preceding ./ in the require paths. Once I updated the modules in index.js with ./, these began resolving (until it encountered other imports in the models):

An example of the error is below:

ERROR in ../../node_modules/docusign-esign/src/model/Zip.js
Module not found: Error: Can't resolve 'model/SmartContractInformation' in '/app/node_modules/docusign-esign/src/model'
@ ../../node_modules/docusign-esign/src/index.js

I dug around and found the following:

https://github.com/webpack/webpack/issues/906 https://github.com/swagger-api/swagger-codegen/issues/3336 https://webpack.js.org/loaders/imports-loader/

I've worked around it by installing imports-loader and adding the following into my webpack config:

{
  test: /docusign-esign\/.*\.js$/,
  use: {
    loader: 'imports-loader',
    options: {
      additionalCode: 'var define = false; /* Disable AMD for misbehaving libraries */',
    },
  },
},

Can the paths be updated to include the relative portion so the workaround isn't needed?

Thanks!

EdwinMoralesDS commented 3 years ago

Internal SDK bug DCM-5025 has been filed. Thank you for the report.

thiwanka-aux commented 3 years ago

I'm still getting webpack error when building docusign-esign module. I tried that work around but didint work. Please let me know other options

jimmyn commented 2 years ago

I'm having the same issue

noah10 commented 2 years ago

I'm having this issue as well. @EdwinMoralesDS , could you please provide a status update on internal SDK bug DCM-5025?

yaniv691 commented 1 year ago

This issue is still happening more than a year after the last comment in the thread. @callumcox's suggestions work, but it's "hacky" due to other config changes needed to be made in order for everything to play nice. Any other, cleaner suggestions?