wc-api-node icon indicating copy to clipboard operation
wc-api-node copied to clipboard

Webpack errors

Open emilsgulbis opened this issue 9 years ago • 9 comments

Hello!

Having errors when trying to use npm package in Webpack build.

Module not found: Error: Can't resolve 'net' in '***/node_modules/forever-agent'
 @ ./~/forever-agent/index.js 6:10-24
 @ ./~/request/request.js
 @ ./~/request/index.js
 @ ./~/woocommerce-api/index.js
 @ ./assets/scripts/bootstrap.js
 @ ./assets/scripts/main.js
ERROR in ./~/forever-agent/index.js

Also Module not found and can't resolve 'tls' and 'fs'

There is something I've missed?

emilsgulbis avatar Feb 09 '17 12:02 emilsgulbis

Maybe there is way to use WooCommerce with official WP API javascript client - models and collections?

emilsgulbis avatar Feb 09 '17 12:02 emilsgulbis

yeah also having this issue with WC-API client and webpack.

andrewmclagan avatar Mar 12 '17 05:03 andrewmclagan

@emilsgulbis fell free to submit a Pull Request.

claudiosanches avatar Mar 13 '17 17:03 claudiosanches

Hi,

Has anyone made any progress on this issue?

itjunkii83 avatar Apr 09 '17 04:04 itjunkii83

+1 have this problem too ....

chi11ax avatar Oct 20 '17 16:10 chi11ax

Here is how I solved it.

npm i --save request &&  npm i --save-dev json-loader

add below config to your webpack

  node: {
    console: true,
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
  },

Ref

link

ruucm avatar Jul 21 '18 12:07 ruucm

@ruucm Thank you so much you saved my life :+1: :)

marayshi avatar Oct 21 '18 18:10 marayshi

@ruucm I had same issue - Your solution helped me. Thanks!

glemigobles avatar Apr 19 '19 09:04 glemigobles

It should be possible with https://github.com/woocommerce/woocommerce-rest-api-js-lib

claudiosanches avatar Jul 29 '19 21:07 claudiosanches