Answer the question
In order to leave comments, you need to log in
How to enable woocommerce api in vue-cli?
I use vue-cli, I want to include this here https://www.npmjs.com/package/woocommerce-api ...
Installed via npm, inserting var WooCommerceAPI = require('woocommerce-api') into main.js, gives error. There is an error in app.vue in script too.
The error itself is:
./node_modules/request/lib/har.js Module not found: Error: Can't resolve 'fs' in /node_modules/request/lib'
@ ./node_modules/request/lib/har.js 3:9 -22
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/woocommerce-api/index.js
@ ./node_modules/babel-loader/lib!./node_modules/vue -loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue @ ./src/main.localhost:8080 webpack/hot/dev-server ./src/main.js Tell me
, thanks!
Answer the question
In order to leave comments, you need to log in
https://www.npmjs.com/package/woocommerce-api - right in the package name it says: WooCommerce API - Node.js Client , and the Vue app runs in the browser (and even after server rendering), so directly use this the client is unlikely to succeed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question