Webpack errors
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?
Maybe there is way to use WooCommerce with official WP API javascript client - models and collections?
yeah also having this issue with WC-API client and webpack.
@emilsgulbis fell free to submit a Pull Request.
Hi,
Has anyone made any progress on this issue?
+1 have this problem too ....
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
@ruucm Thank you so much you saved my life :+1: :)
@ruucm I had same issue - Your solution helped me. Thanks!
It should be possible with https://github.com/woocommerce/woocommerce-rest-api-js-lib