Use webpack/Babel to compile react-tools.js #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We'd previously introduced a
package.json
to support our JS unit tests; this PR adds a coupledevDependencies
and upgrades a few others. Ayarn install
will be required after merging sincepackage.json
andyarn.lock
have changed.JS testing is still performed the same way, by running
yarn test
.In addition, the following files were added:
srcjs/react-tools.js
: This is the input file to Babel's transformations. Runningyarn run webpack
compiles this file intoinst/www/react-tools/react-tools.js
which was previously hand-edited but should still be version-controlled. After this PR, it should not be edited by hand. I copied the source file to its new location without changing any syntax. I figure we can do that moving forward, incrementally, since we'll have support for it.inst/www/react-tools/react-tools.js.map
: Source map that corresponds toreact-tools.js.map
and improves the debugging experience. Should also be version-controlled.webpack.config.js
: We used to have a webpack configuration, but it was embedded inkarma.conf.js
and used only for building the tests. Now, it's a separate file, and contains some additional configuration.karma.conf.js
does not duplicate this configuration. Instead, it importswebpack.config.js
as a module and refers to itsmodule
configuration property. This means that changes to the webpack configuration can be made in one place and they should be picked up both when building release JS and when testing JS.