title: Why Babel 7 uses require() function for browser which knows nothing about it?
body: <p>I try to use d3.js in my module. I use Babel 7 for  transpiling my code sources. 
  This is my <code>package.json</code>:</p>
  
  <pre><code>{
    "name": "d3_learning",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "directories": {
      "test": "test"
    },
    "scripts": {
      "build": "babel src --out-dir dist --source-maps --minified --no-comments",
      "build:watch": "npm run build -- -w"
    },
    "babel": {
      "presets": [
        [
          "@babel/preset-env",
          {
            "useBuiltIns": "entry",
            "targets": {
              "firefox": "64",
              "opera": "57",
              "chrome": "71",
              "edge": "44",
              "ie": "11"
            }
          }
        ]
      ]
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "@babel/cli": "^7.2.3",
      "@babel/core": "^7.2.2",
      "@babel/node": "^7.2.2",
      "@babel/polyfill": "^7.2.5",
      "@babel/preset-env": "^7.2.3",
      "@babel/register": "^7.0.0"
    },
    "dependencies": {
      "d3": "^5.7.0"
    }
  }
  </code></pre>
  
  <p>Pay attention in the <code>targets</code> section I pointed the versions of web browsers are interest for me. Browsers know nothing about <code>require</code> function. Only Node.js knows about it.</p>
  
  <p>This is my source code:</p>
  
  <pre><code>import * as d3 from 'd3';
  
  function draw(data) {
      // ...
  }
  
  d3.json('../data/some-data.json', draw);
  </code></pre>
  
  <p>But I see Babel 7 code generation result contains <code>require</code> function:</p>
  
  <p><code>"use strict";var d3=_interopRequireWildcard(require("d3"));...</code></p>
  
  <p>Therefore I get runtime error in the browser:</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: require is not defined</p>
  </blockquote>
  
  <p>Why does it happen and how can I solve the problem?</p>