Configure @absolute path in Vue project

Note: @ is defined by default in the vue project to represent the path of the src folder.
Create a new vue.config.js file:

const path = require('path')
const resolve = dir => {
    
    
  return path.join(__dirname, dir)
}
 
module.exports = {
    
    
  chainWebpack: config => {
    
    
    config.resolve.alias
      .set('@', resolve('src'))
      .set('_v', resolve('src/views'))
  }
}

Guess you like

Origin blog.csdn.net/hujian66/article/details/124600225