// module.exports = {
//     // entry: './src/index.js',
//     // output: {
//     //   path: path.resolve(__dirname, './'),
//     //   filename: '../index.js',
//     //   library: 'VueBaiduMap',
//     //   libraryTarget: 'umd'
//     // },
//     module: {
//         rules: [{
//                 test: /\.vue$/,
//                 loader: 'vue-loader'
//             },
//             {
//                 test: /\.js$/,
//                 loader: 'babel-loader',
//                 exclude: /node_modules/
//             }
//         ]
//     },
//     resolve: {
//         alias: {
//             vue: 'vue/dist/vue.js'
//         }
//     }
// }
const path = require('path')
    // const BabiliPlugin = require("babili-webpack-plugin");
    //判断是否是开发环境
const devMode = process.env.NODE_ENV === "development";

function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    entry: './components/index.js',
    output: {
        publicPath: devMode ? "" : "/",
        //这里的name即为我们entry对象中的每一个key值，也就是我们在pages目录下创建的一个个文件夹的名称
        filename: devMode ? "[name].js" : "static/js/[name].[chunkhash].js",
        path: path.resolve(__dirname, "../dist")
    },
    module: {
        rules: [{
                test: /\.vue$/,
                loader: 'vue-loader'
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/,
                options: {
                    presets: ['es2015']
                }
            },
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            },
            {
                test: /\.scss$/,
                use: ['style-loader', 'css-loader', 'sass-loader']
            },
            {
                test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
                loader: 'url-loader'
            },
            {
                test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
                loader: 'url-loader'
            }
        ]
    }
    // plugins: [
    //     new BabiliPlugin()
    // ],
}