vue.config.js 1.39 KB
const fs = require("fs");
const path = require("path");
const webpack = require("webpack");
const apiMocker = require('mocker-api');

module.exports = {
    publicPath:"./",
    pages:{
      app:{
          entry:'./src/entry/app.js',
          template:path.join(__dirname,"public/index.html"),
          filename:"index.html",
          title:"首页",
          //chunks:[...chunks,"app"]
      }
    },
    css:{
        extract:false,
    },
    //配置文件
    chainWebpack:config=>{ 
         
         const entry = config.entry('app')
         entry
         .add('babel-polyfill')
         .end()
         entry
         .add('classlist-polyfill')
         .end()
         
        config.module
             .rule('iview') 
             .test(/iview.src.*?js$/) 
             .use('babel') 
             .loader('babel-loader') 
             .end() 
            
        
    },
    configureWebpack:{
        resolve:{
            alias: {
             // "@src":path.join(__dirname,"/src")
            }
        },
        plugins:[
            // new webpack.DefinePlugin({
            //     VERSION:1
            // })

        ]
    },
   
    devServer: {
        host:"127.0.0.1",
        before:(app, server)=>{
            apiMocker(app,path.join(__dirname,"/src/service/mocker/index.js"),{
                         
            })
      
              
            
        }
            
     }
}