sourcecred/config
William Chargin 9b31905ab4
babel: transform ES6 modules to CommonJS (#766)
Summary:
The approach used by `create-react-app` (the source of this code) seems
to be the following: write everything as ES6 modules (`import`/`export`)
and bundle everything with Webpack—in particular, do not transform
modules with Babel.

This works fine until you want to also access some of these modules from
raw Node. Node only supports CommonJS modules, so these “polyglot”
modules must be CommonJS-compatible. But CommonJS modules are not nicely
compatible with ES6 modules: you need to set `exports.default` instead
of `module.exports` in the provider, and dereference `.default` after
each `require`. Babel will perform these transformations for us if we
ask it to. In this patch, we do so.

Test Plan:
Note that `yarn test --full` passes and `yarn start` still works.
(Follow-up commits will exercise this functionality.)

wchargin-branch: transform-es6-modules
2018-09-04 21:47:36 -07:00
..
jest Add `GitState`, `Environment` to the `VersionInfo` (#692) 2018-08-16 13:38:13 -07:00
RemoveBuildDirectoryPlugin.js webpack: empty build dir instead of removing it (#768) 2018-09-04 21:44:09 -07:00
babel.js babel: transform ES6 modules to CommonJS (#766) 2018-09-04 21:47:36 -07:00
env.js Allow backend `process.env` to see the runtime env (#748) 2018-08-31 16:34:18 -07:00
paths.js Replace `oclif` with `cli` (#744) 2018-09-02 16:11:56 -07:00
polyfills.js Ensure that flow is used in all js files (#232) 2018-05-07 20:02:19 -07:00
test.js Add `sharness` for shell-based testing (#597) 2018-08-06 12:56:25 -07:00
webpack.config.backend.js Allow backend `process.env` to see the runtime env (#748) 2018-08-31 16:34:18 -07:00
webpack.config.web.js Rename `makeWebpackConfig` to `webpack.config.web` (#770) 2018-09-04 21:45:10 -07:00