Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Upgrade dev build tooling (Babel 6 -> 7, Webpack 1 -> 4) #1235

Merged
merged 4 commits into from
Nov 22, 2018

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Nov 21, 2018

Our build tooling was super outdated, which made maintenance kind of a chore. I think this step, while not totally necessary, will help with issues like #1214 and #1090.

Build sizes

I also decided (at least unless someone knows of a good reason not to do this) to stick with Webpack's default minification behavior– which is to say, do it for production builds. This resulted in the following built size reductions:

Standalone:

  • backend.js: 215KB -> 97KB
  • standalone.js: 1.3MB -> 601KB

Browser extension:

  • packed and zipped extension: 1.8MB -> 840KB
  • backend.js: 395KB -> 152KB
  • panel.js: 1.3MB -> 606KB

Build times

I timed yarn build:standalone and yarn build:extension:chrome in master and this branch and didn't notice any real difference in durations. (The duration varies between runs but seems to be about the same overall.)

Testing

I've tested the example app, plain shell, Firefox and Chrome extensions, standalone DevTools, and the theme viewer. All seem okay after this change.

I also updated the backend/integration Webpack config, although I'm pretty sure that test hasn't been used in a long time– since the source has an invalid require (referencing a file that was moved a while back).

@@ -78,7 +78,7 @@ class Todos extends React.Component {
todos.some(item => {
if (item.id === id) {
item.completed = completed;
text = item.text;
text = item.title;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happened to be broken before. I noticed while testing the new config.

@bvaughn bvaughn mentioned this pull request Nov 21, 2018
test: /\.js$/,
loader: 'babel-loader',
options: {
...JSON.parse(readFileSync(resolve(__dirname, '../../.babelrc'))),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this spread operator really needed? You could remove the object braces and set options to the result of JSON.parse

Maybe I'm missing something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally, I thought I might add some custom options to individual configs but that turned out not to be necessary.

test: /\.js$/,
loader: 'babel-loader',
options: {
...JSON.parse(readFileSync(resolve(__dirname, '../../.babelrc'))),
Copy link

@hugmanrique hugmanrique Nov 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as above (there are more occurences below, won't comment on those).

@bvaughn
Copy link
Contributor Author

bvaughn commented Nov 22, 2018

I am going to land this. I'll take responsibility for anything that pops up as a result and fix it with a follow-up PR. I think the more interesting PR to get feedback on is #1236 which this soft blocks.

@bvaughn bvaughn merged commit 28d36a2 into facebook:master Nov 22, 2018
@bvaughn bvaughn deleted the webpack-upgrade branch November 22, 2018 19:30
bvaughn pushed a commit that referenced this pull request Jan 4, 2019
Some time ago, when updating Babel and Webpack (PR #1235) the 'libraryTarget' Webpack setting was accidentally changed from 'umd' to default (global) which, I believe, caused the subsequent 3.5.0 react-devtools/react-devtools-core releases to break. This change restores the 'libraryTarget' value to 'umd' for the backend.'
git status
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants