I am using Vuex and using store.js for the first time. In my main.js file I am using

import { store } from './store/store'

new Vue({
  el: '#app',
  store,
  render: h => h(App)
})

and everytime I run this I keep getting this error.

ERROR in ./src/store/store.js
Module not found: Error: Can't resolve '.vue' in '/Users/briansantos/code/Vuex/src/store'
 @ ./src/store/store.js 1:0-23
 @ ./src/main.js
 @ multi main

ERROR in ./src/store/store.js
Module not found: Error: Can't resolve '.vuex' in '/Users/briansantos/code/Vuex/src/store'
 @ ./src/store/store.js 2:0-25
 @ ./src/main.js
 @ multi main

I have tried scouring the internet and have found several peopole saying that this is a dependency issue and I have checked for updates and with no luck have found an answer. Below is my store.js file in my store folder.

import Vue from '.vue';
import Vuex from '.vuex';

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        counter: 0
    }
})

If anyone could help me understand what is happening and how to correct this. Here is the repo all you have to do is clone and npm install.

https://github.com/brianmsantos/Vuex

1 Answers

0
Dima Kuzmich On

Your problem is with the imports of Vue packages. You have to remove the dot prefix from them, like so:

import Vue from 'vue';
import Vuex from 'vuex';

Those packages come from node_modules, thus don't need to be prefixed by .