I'm trying to import a json file in my vue component but its giving this error
ERROR in ./~/buble-loader?{"objectAssign":"Object.assign"}!./~/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/src/App.vue Module not found: Error: Can't resolve 'assets/incomingData.json' in '/var/www/html/mac/resources/assets/src'
script:
import jsonData from 'assets/incomingData.json'
export default {
name: 'app',
data () {
return {
entryData: jsonData,
outputData: ''
}
},
created () {
this.$store.commit('setEntryData', this.entryData['bundle'])
this.$store.commit('setTargetRate', this.entryData.targetNetRate)
},
beforeMount () {
this.$store.dispatch('calculate').then(res => {
this.outputData = this.$store.getters.getCalculatedData
})
}
}
folder structure:
package.json
any suggestions how do I fix this issue ?
pubilc
folder and try likeimport jsonData from '/assets/incomingData.json'
– Niklesh Rautstore
folder ? – Niklesh RautApp.vue
is in store folder – 06011991import jsonData from 'assets/incomingData.json'
? without..
double dot – Niklesh Raut