关于javascript:vue前端webpack-路径配置个人笔记

39次阅读

共计 643 个字符,预计需要花费 2 分钟才能阅读完成。

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,
}

正文完
 0