Critical dependency: the request of a dependency is an expression
See original GitHub issueI’m trying to integrate the woocommerce virtual store module into my project and when I add the mutation “add_product_to_cart” I get the following error.
./~/ajv/lib/async.js
96:20-33 Critical dependency: the request of a dependency is an expression
The vue module:
<template>
<div class="field has-addons">
<p class="control is-expanded">
<input class="input is-medium" type="text" placeholder="Código do produto" v-model="productCode">
</p>
<p class="control">
<button class="button is-info is-medium" @click="findProduct">
Adicionar
</button>
</p>
</div>
</template>
<script>
export default {
data () {
return {
productCode: ''
}
},
methods: {
findProduct () {
this.$store.commit('ADD_PRODUCT_TO_CART', this.productCode)
}
},
name: 'find-product'
}
</script>
The state/mutation module:
import * as types from '../mutation-types'
import Woo from 'woocommerce-api'
const wc = new Woo({
url: 'http://wc-project.dev',
consumerKey: 'ck_**',
consumerSecret: 'cs_**',
version: 'wc/v1',
wpAPI: true
})
const state = {
products: []
}
const mutations = {
[types.ADD_PRODUCT_TO_CART] (state, payload) {
console.log(payload)
wc.get(`products/${payload}`, (err, data, res) => {
if (err) return console.log(err)
return console.log(res)
})
}
}
export default {
state,
mutations
}
Please ignore all this console.log, if i use only 1 console.log with console.log(payload)
works fine.
- Node version: v7.8.0
- NPM version: 4.5.0
- vue-cli version: 2.8.1
- Operating System: Lubuntu (32bits)
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Webpack - Critical dependency: the request of a dependency ...
Webpack - Critical dependency: the request of a dependency is an expression · Manually configure webpack to import the required libraries and ...
Read more >Webpack Warning: Critical dependency: the request of a ...
[Edit: This seems to be related with WebPack in General, not with Angular] When activating this module in an Angular 12 project, this...
Read more >the request of a dependency is an expression webpack - You ...
Webpack - Critical dependency: the request of a dependency is an expression ... When a library uses variables or expressions in a require...
Read more >the request of a dependency is an expression - Get Help
When I use “require( )” inside a v-bind:src directive, I get “the warning Critical dependency: the request of a dependency is an expression” ......
Read more >Integration with WebPack - Linkurious documentation
The optional dependencies used by Ogma is the xlsx library (to export in the XLSX ... Critical dependency: the request of a dependency...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guys, I think I have found the problem. The npm modules I was using to call my external API wasn’t installed in the /app/package.json. I had installed them only in the root directory /package.json. They need to be there in order to be found during the building process. @rafa-acioly please, see if this is your scenario as well.
I’ll check and respond after the test, thank you! @melquic