webpack问题,这个path.join干啥用的,直接写相对路径不行?

output: {
        path: path.join(__dirname, './dist'),
        filename: '[name].js',
        publicPath: '/dist/'
    },

写成./dist,为何这么写(下面是我的写法)

var path = require('path');
// 定义路径
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'app');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');

module.exports = {
    // 项目的文件夹
    entry: './src/app.js',
    // 输出的文件名 合并以后的js会命名为bundle.js
    module: {
        // 加载器
        loaders: [{
            test: /\.css$/,
            loader: 'style-loader!css-loader'
        }, {
            test: /\.(png|jpg|gif)$/,
            loader: 'url-loader?limit=8192'
        }, ]
    },
    output: {
        path: BUILD_PATH,
        filename: '[name].js'
    },
};
查看回复