Encountering an issue while attempting to import a file using a custom alias:
import api from 'api'
api in ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/exercises.vue?vue&type=script&lang=js&
Below is my nuxt.config.js setup:
import { resolve } from 'path'
const _api = process.env.API_MOCK === '1' ? 'apimock': 'api'
export default {
buildModules: [
'@nuxtjs/vuetify',
'@nuxtjs/router'
],
alias: {
'api': resolve(__dirname, './helpers/' + _api)
},
}
Reviewing my project's file structure reveals the following:
.
├── components
│ ├── drawer.vue
│ ├── popup-criar-treino.vue
│ ├── popup-treino.vue
│ └── toolbar.vue
├── helpers
│ ├── api
│ │ └── urls.js
│ └── apimock
│ ├── db_mock
│ │ └── db_mock.js
│ ├── mockadapter.js
│ └── urls.js
├── jsconfig.json
├── layouts
│ └── default.vue
├── nuxt.config.js
├── package.json
├── package-lock.json
├── pages
│ ├── exercises.vue
│ ├── index.vue
│ ├── plans.vue
│ └── treinos.vue
└── router.js
A bit puzzled as to what might be missing here, despite diligently following Nuxt documentation guidance provided at: https://nuxtjs.org/docs/configuration-glossary/configuration-alias/