const path = require('path')
const resolve = dir => {
  return path.join(__dirname, dir)
}
module.exports = {
  publicPath: './', // 部署应用包是的基本URL， ./为相对路径
  outputDir: 'dist', // build后生产环境构建文件的目录
  assetsDir: 'static', // 放置生成的静态资源的相对于outputDir的目录
  pages:{
    index:{
      entry: "examples/main.js", // js文件修改,
      template: "public/index.html",
      filename: "index.html"
    }
  },
  chainWebpack: config => {
    config.resolve.symlinks(true)
    config.resolve.alias
      .set('~', resolve('packages')) // key,value自行定义，比如.set('@@', resolve('src/components'))
      .set('@', resolve('examples')) // key,value自行定义，比如.set('@@', resolve('src/components'))
    config.module
      .rule("js")
      .include.add("/packages")
      .end()
      .include.add("/examples")
      .end()
      .use("babel")
      .loader("babel-loader")
    // 使用vue-markdown-loader
    config.module.rule("md")
      .test(/\.md/)
      .use("vue-loader")
      .loader("vue-loader")
      .end()
      .use("vue-markdown-loader")
      .loader("vue-markdown-loader/lib/markdown-compiler")
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          javascriptEnabled: true,
        },
      },
    },

  },
  configureWebpack: {
    externals: {
      "AMap": "AMap"
    }
  }
}
