ОШИБКА Не удалось скомпилировать с ошибками 1 Эта зависимость не найдена: - PullRequest
0 голосов
/ 15 мая 2018

Я получаю сообщение об ошибке в компоненте vue при попытке импортировать другой файл javascript, находящийся в этом каталоге services / AuthenticationService

Модуль не найден: ошибка: не удается разрешить '@ / services / AuthenticationService' Чтобы установить его, вы можете запустить: npm install --save @ / services / AuthenticationService

Я искал решение этой проблемы, но ничего не могу найти. Любая помощь будет оценена

Это мой вид компонента register.vue

<template>
  <div>
<h1>Register</h1>
     <input type="email" name="email" v-model ="email" placeholder="email"> <br>
     <input type="password" name="password" v-model ="password" placeholder="password"> <br>
      <button @click="register">
      Register
    </button>
  </div>
</template>

<script>
import AuthenticationService from '@/services/AuthenticationService'
export default {
  data () {
    return {
      email: '',
      password: ''
    }
  },

  methods: {
  async register(){
  const response = await AuthenticationService.register({
        email: this.email,
        password: this.password
      })
  console.log(response.data)
    }
  }
}
</script>

<style scoped></style>

1 Ответ

0 голосов
/ 15 мая 2018

У вас есть разрешение в вашей конфигурации веб-пакета?

resolve: {
  alias: {
    '@': path.resolve('path/to/your/source/folder')
  }
}

Документ https://webpack.js.org/configuration/resolve/

...