vue前端webpack 路径配置(个人笔记)

const path = require(`path`)

function resolve (dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: `./`,
  assetsDir: `assets`,
  chainWebpack: (config) => {
     config.module.rule(`eslint`).
      use(`eslint-loader`).
      loader(`eslint-loader`).
      tap(options => {
        options.fix = true
        return options
      })
    // 设置项目目录别名,其余使用jsconfig的@/
    config.resolve.alias.set(`@`, resolve(`src`)).
      set(`@assets`, resolve(`src/assets`)).
      set(`@components`, resolve(`src/components`)).
      set(`@views`, resolve(`src/views`)).
      set(`@static`, resolve(`src/static`))

  }
  transpileDependencies: [],
  configureWebpack: {},

  devServer: {},
  outputDir: undefined,
  runtimeCompiler: true,
  productionSourceMap: false,
  parallel: undefined,
}

你可能感兴趣的:(vue前端webpack 路径配置(个人笔记))