MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
947 stars 278 forks source link

unable to use it with typescript. Any Suggestions please #614

Closed tayyab48 closed 8 months ago

tayyab48 commented 1 year ago

Hi,

I am unable to use the shopify-api-node with typescript project or Angular 14/16 projects. I am getting following error. Kindly help me in this regards.

ERROR in ./node_modules/shopify-api-node/index.js 9:12-32 Module not found: Error: Can't resolve './package' in 'E:\Projects\code\apis\node_modules\shopify-api-node' resolve './package' in 'E:\Projects\code\apis\node_modules\shopify-api-node' using description file: E:\Projects\code\apis\node_modules\shopify-api-node\package.json (relative path: .) using description file: E:\Projects\code\apis\node_modules\shopify-api-node\package.json (relative path: ./package) no extension E:\Projects\code\apis\node_modules\shopify-api-node\package doesn't exist .ts E:\Projects\code\apis\node_modules\shopify-api-node\package.ts doesn't exist .js E:\Projects\code\apis\node_modules\shopify-api-node\package.js doesn't exist as directory E:\Projects\slatebrands\code\apis\node_modules\shopify-api-node\package doesn't exist @ ./src/lambdas/retrieve-product/retrive-products.ts 2:16-43

webpack 5.88.0 compiled with 1 error and 1 warning in 20767 ms

lpinca commented 1 year ago

Make sure that the webpack config allows the use of CommonJS modules.

daniellangnet commented 11 months ago

For me, it was that .json had to be included in webpack.config here:

resolve: {
  extensions: [".ts", ".js", ".json"],
},