vue.config.js 1.6 KB
const path = require('path');

module.exports = {
  // 修改 src 为 examples
  pages: {
    index: {
      entry: 'examples/main.js',
      template: 'public/index.html',
      filename: 'index.html'
    }
  },
  // eslint-loader 是否在保存的时候检查
  lintOnSave: true,
  // webpack配置 写法1
  // configureWebpack: {
  //   resolve: {
  //     alias: {
  //       '@': path.resolve(__dirname, 'examples'),
  //     }
  //   },
  //   module: {
  //     rules: [
  //       {
  //         test: /\.md$/,
  //         use: [
  //           'vue-loader',
  //           path.resolve(__dirname, "./webpack/markdown-loader.js"),
  //         ],
  //       }
  //     ]
  //   }
  // },
  // webpack配置 写法2
  configureWebpack: config => {
    config.resolve.alias['@'] = path.resolve(__dirname, 'examples');
    config.module.rules.push({
      test: /\.md$/,
      use: [
        'vue-loader',
        path.resolve(__dirname, "./webpack/markdown-loader.js"),
      ],
    });
  },
  // webpack配置 链式写法
  // chainWebpack: config => {
  //   config.resolve.alias
  //     .set('@', path.resolve(__dirname, 'examples'))
  //   config.module
  //     .rule("md")
  //     .test(/\.md/)
  //       .use("vue")
  //         .loader("vue-loader")
  //         .end()
  //       .use("markdown")
  //         .loader(
  //           path.resolve(__dirname, "./webpack/markdown-loader.js")
  //         )
  //         .end();
  // },
  // webpack-dev-server 相关配置
  devServer: {
    open: false,
    host: '0.0.0.0',
    port: 8888,
    https: false,
    hotOnly: false,
    disableHostCheck: true,
  },
}