Thunfische
Thunfische

Reputation: 1157

How do I choose the output file directory in Webpack?

When I run webpack with "webpack --mode development", it creates a dist folder and put the bundle.js in it. I want it to create and put it in the same directory. How do I do it?

    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
        }
    }

Upvotes: 1

Views: 154

Answers (1)

JohMun
JohMun

Reputation: 446

You can define it with the path property e.g.

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

change it to: path: __dirname,

Upvotes: 4

Related Questions