乐趣区

关于javascript: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,
}
退出移动版