SooJungChae
SooJungChae

Reputation: 239

How webpack.config.js work in react project?

I saw react + express project code here, start project just using this codes.

But I can't find how to read/execute webpack.config.js command. Who read this code? and how it works?

Upvotes: 2

Views: 699

Answers (2)

Bryan
Bryan

Reputation: 687

You don't execute webpack.config.js. It is a configuration file that webpack will refer to and use when webpack is run. See this page for more info.

The build and start scripts in the package.json file for the project you linked to both run webpack. Webpack will then create a bundle.js file according to the information in webpack.config.js.

Upvotes: 2

mehmetseckin
mehmetseckin

Reputation: 3107

Webpack reads webpack.config.js by default, unless you explicitly tell it to read another config file by using the --config argument, e.g.:

webpack --config another.config.js

In your case, this command reads the webpack.config.js:

./node_modules/.bin/webpack --progress

Upvotes: 3

Related Questions