Adrianr28064212
Adrianr28064212

Reputation: 101

This relative module was not found?

I tried running npm run serve, and it came back with this error:

This relative Module was not found:

*./components/Map.vue 

It exists, and I'm pretty sure I've linked the pages right. How do I correct this?

My config looks like this:

module.exports = {
  pages: {
    home: {
      
      entry: './src/components/main.js',
      
      template: './src/pages/home/App.vue',
      
      filename: './src/pages/home/App.vue',
      
      title: 'Home Page',
      
      chunks: ['chunk-vendors', 'chunk-common', 'Home']
    },
    map: {
      
      entry: './src/pages/map/main.js',
      
      template: './src/pages/map/App.vue',
      
      filename: './src/pages/map/App.vue',
      
      title: 'Map',
      
      chunks: ['chunk-vendors', 'chunk-common', 'Map']
      },
  }
}

Am I linking things wrong?

edit:

I have changed my templating based on another answer given on here to the a similar question. Now it's telling me:

These dependencies were not found:

And is saying I can download them.

module.exports = {
  pages: {
    'index': {
      entry: './src/pages/Home/main.js',
      template: 'public/index.html',
      title: 'Home',
      chunks: [ 'chunk-vendors', 'chunk-common', 'index' ]
    },
    'map': {
      entry: './src/pages/Map/main.js',
      template: 'public/index.html',
      title: 'Map',
      chunks: [ 'chunk-vendors', 'chunk-common', 'about' ]
    }
  }
}

Upvotes: 2

Views: 3751

Answers (2)

Juliano Soder
Juliano Soder

Reputation: 9

use @ before import yours modules, like it:

import BntPayment from '@/components/BntPayment.vue'

the @ should fix your issue, if it doesn't works do like this

import BntPayment from './components/BntPayment'

Upvotes: 0

tony19
tony19

Reputation: 138696

The error is likely caused by the invalid config you currently have.

From the docs for pages:

  • template should point to an .html file (not a .vue file)
  • entry should be a .js file (that imports a .vue file)
  • filename should be the output filename in the output folder (don't link it back to the original source files)

Upvotes: 1

Related Questions