likes
comments
collection
share

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

作者站长头像
站长
· 阅读数 31
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,
}
转载自:https://segmentfault.com/a/1190000040647701
评论
请登录