当我使用“ webpack --mode development”运行webpack时,它将创建一个dist文件夹并将bundle.js放入其中。我希望它创建并将其放在同一目录中。我该怎么做?

    module.exports = {

        entry: "./main.js", //relative to root of the application
        output: {
            filename: "./app.bundle.js" //relative to root of the application
        },
        watchOptions: {
            aggregateTimeout: 300,
            poll: 1000
        }
    }

最佳答案

您可以使用path属性进行定义,例如

output: {
  path: __dirname + '/dist',
  filename: 'bundle.js'
}


更改为:path: __dirname,

09-20 23:57