.babelrc configuration placed in package.JSON : <p>Currently exploring webpack different tools associated with it. Now I am using Babel for transpiling <code>ES6</code> code into <code>ES5</code> code. I came accross the need for a <code>.babelrc</code> file which holds the configurations for Babel. However, on the website of Babel I also saw that you could also place these configurations into the <code>package.json</code> file. Like this:</p>

<p><strong>Package.json File:</strong></p>

<pre><code>{
  "name": "webpack-tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "dev": "webpack --mode development",
    "build": "webpack --mode production"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-preset-env": "^1.7.0",
    "webpack": "^4.16.2",
    "webpack-cli": "^3.1.0"
  },
  "babel": {
    "presets": [
        "env"
    ]
  }

}
</code></pre>

<p>Now when I run <code>npm run dev</code> Babel also works and the code gets transpiled succesfully. </p>

<p>How does Babel know to access the package.json file? Does it first look for an <code>.babelrc</code> file and then if this is not present does it automatically look for its configurations in the <code>package.json</code>? How does Webpack interact with both <code>Babel</code> and the <code>package.json</code> file to produce this result?</p>
