Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dependencies] Update to React 16, Webpack 4, Babel 7 #88

Merged
merged 8 commits into from
May 23, 2019

Conversation

hydrosquall
Copy link
Contributor

@hydrosquall hydrosquall commented May 11, 2019

This PR sits on top of changes from #85, but I can drop those commits if that PR doesn't end up getting merged first. It addresses #87 by bringing this project up to the latest react so that people can use current UI libraries to add to the project.

Primary Changes

  • Webpack 1 -> 4
  • React/React-Dom 14 -> 16
  • Pull out the .babelrc config file so that parcel and the webpack file can share the configuration.
  • Transformed components to use class syntax because React.createClass is no longer used in react 16, using this jscodeshift

The preview deploy branch for this set of changes is available here, I believe everything builds correctly.

https://5cd74c6f696d0e00070244d8--blockbuilder-search-hydrosquall.netlify.com/

I also confirmed locally that the package maintains functionality when used with the core blockbuilder app using npm link.

@hydrosquall hydrosquall changed the title Feature/update to react 16 [dependencies] Update to React 16 May 11, 2019
@hydrosquall hydrosquall changed the title [dependencies] Update to React 16 [dependencies] Update to React 16, Webpack 4, Babel 7 May 11, 2019
@hydrosquall
Copy link
Contributor Author

Note that bundle.js isn't actually deleted, just dramatically changed, I've heard that Github UI has trouble with displaying large diffs.

@micahstubbs
Copy link
Collaborator

@hydrosquall thanks for for upgrading the dependencies! I've been meaning to do this for a while.

curious, could you factor out the changes from #86, so that this only includes the dependency upgrades?

@hydrosquall
Copy link
Contributor Author

hydrosquall commented May 16, 2019 via email

@hydrosquall hydrosquall force-pushed the feature/update-to-react-16 branch from db7fc90 to 95148b8 Compare May 16, 2019 02:03
@hydrosquall
Copy link
Contributor Author

@micahstubbs I pulled out the changes from #86 since that would otherwise have modified package.json, and regenerated the lockfile / bundle.js.

@micahstubbs
Copy link
Collaborator

nice! will have a look

@micahstubbs
Copy link
Collaborator

micahstubbs commented May 18, 2019

doing some troubleshooting

(py27) ➜  blockbuilder-search git:(hydrosquall-feature/update-to-react-16) ✗ yarn buildWatch
yarn run v1.13.0
$ webpack --color --progress --watch
Hash: d437a155a1da4cdfeeeb
Version: webpack 1.15.0
Time: 36ms
    Asset     Size  Chunks             Chunk Names
bundle.js  3.56 kB       0  [emitted]  main
   [0] multi main 28 bytes {0} [built] [1 error]

ERROR in multi main
Module not found: Error: Cannot resolve 'file' or 'directory' ./src/main.js in /Users/m/workspace/blockbuilder-search
 @ multi main

probably need to run yarn again to install the new packages

@micahstubbs
Copy link
Collaborator

ok, looks like something is up with the bundle now 🤔

Screen Shot 2019-05-18 at 1 56 10 PM

search:12 GET http://localhost:8889/public-search/bundle.js net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)

@micahstubbs
Copy link
Collaborator

@micahstubbs
Copy link
Collaborator

interesting, so Firefox gives us a more useful error message:

Screen Shot 2019-05-18 at 1 59 38 PM

TypeError: action.data is undefined[Learn More] bundle.js:22875:10
Source map error: SyntaxError: JSON.parse: unterminated string at line 1 column 1428791 of the JSON data
Resource URL: http://localhost:8889/public-search/bundle.js
Source Map URL: data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgNzAzMmNiNWMwNDNhMGI3ZDU5NGMiLCJ3ZWJwYWNrOi8vLy4vcmVhY3QvbWFpbi5qcyIsIndlYnBhY2s6Ly8vLi9yZWFjdC9zdHlsZS9tYWluLnNjc3M/YzY4OSIsIndlYnBhY2s6Ly8vLi9yZWFjdC9zdHlsZS9tYWluLnNjc3MiLCJ3ZWJwYWNrOi8vLy4vfi9jc3MtbG9hZGVyL2xpYi9jc3MtYmFzZS5qcyIsIndlYnBhY2s6Ly8vLi9+L3N0eWxlLWxvYWRlci9hZGRTdHlsZXMuanMiLCJ3ZWJwYWNrOi8vLy4vfi9yZWFjdC9yZWFjdC5qcyIsIndlYnBhY2s6Ly8vLi9+L3JlYWN0L2xpYi9SZWFjdC5qcyIsIndlYnBhY2s6Ly8vLi9+L3JlYWN0L2xpYi9SZWFjdERPTS5qcyIsIndlYnBhY2s6Ly8vLi9+L3Byb2Nlc3MvYnJvd3Nlci5qcyIsIndlYnBhY2s6Ly8vLi9+L3JlYWN0L2xpYi9SZWFjdEN1cnJlbnRPd25lci5qcyIsIndlYnBhY2s6Ly8vLi9+L3JlYWN0L2xpYi9SZWFjdERPTVRleHRDb21wb25lbnQuanMiLCJ3ZWJwYWNrOi8vLy4vfi9yZWFjdC9saWIvRE9NQ2hpbGRyZW5PcGVyYXRpb25zLmpzIiwid2VicGFjazovLy8uL34v…[Learn More]

@micahstubbs
Copy link
Collaborator

micahstubbs commented May 19, 2019

made two small commits to preserve the webpack progress bar feature (looks like it got moved to a plugin sometime between weppack 1 and webpack 4)

https://www.npmjs.com/package/progress-bar-webpack-plugin

@hydrosquall
Copy link
Contributor Author

Thanks for bringing back the color and progress bar functionality :)!

Unfortunately I haven't been able to reproduce the chunked encoding error, but I've gotten it in other projects before if I ran yarn install while some form of webpack watch mode was on. Usually restarting watch mode after the yarn install would fix it.

Are you still seeing the incomplete chunked encoding message?

@hydrosquall
Copy link
Contributor Author

I tried out this modified branch together with the docker-compose setup over in enjalot/blockbuilder#232 and it seems to work :)!

@micahstubbs
Copy link
Collaborator

huh, will take another look.

I'd like to ensure that the local blockbuilder + local blockbuilder-search UI dev setup still works, as a baseline.

@micahstubbs
Copy link
Collaborator

micahstubbs commented May 21, 2019

Ok, so I am trying this:

  1. stopping the yarn buildWatch process
  2. rm -rf node_modules
  3. yarn to install packages
  4. restart yarn buildWatch

@micahstubbs
Copy link
Collaborator

micahstubbs commented May 21, 2019

strange, still see net::ERR_INCOMPLETE_CHUNKED_ENCODING
Screen Shot 2019-05-20 at 8 40 03 PM

@micahstubbs
Copy link
Collaborator

@hydrosquall what does your environment look like? here's mine:

node -v
v11.10.0

yarn -v
1.16.0

@hydrosquall
Copy link
Contributor Author

hydrosquall commented May 21, 2019 via email

@hydrosquall
Copy link
Contributor Author

hydrosquall commented May 22, 2019

If we end up hitting a standstill in reproducing the chunking issue, what I could try instead is to do a version of #90 without the library upgrades. This would let us test the search page by itself without needing to spin up blockbuilder and go through the whole npm link dance. Then we could test all PRs in a clean environment through tools like codesandbox or stackblitz.

What do you think?

(To simplify things, I've put together the PR I described above here: #91 ). If we merge that first, it might help with testing on this branch.

@micahstubbs
Copy link
Collaborator

micahstubbs commented May 22, 2019

@hydrosquall I fixed the chunk encoding problem 🎉

the solution was:

thanks for your patience with this one. It's important to me to make sure that we keep the current blockbuilder + blockbuilder search setup working, since this is how we run the site in production right now.

of course, I'm open to improving how we run the site in production also, but later. one change at a time 😄

@micahstubbs
Copy link
Collaborator

so, once I get a review and enjalot/blockbuilder#235 goes in, we should be able to merge this one too.

@hydrosquall
Copy link
Contributor Author

hydrosquall commented May 22, 2019 via email

@enjalot
Copy link
Owner

enjalot commented May 23, 2019

thanks for doing this and digging in. I'll let @micahstubbs hit the merge button when ready

@micahstubbs micahstubbs merged commit ebfd44b into enjalot:master May 23, 2019
@micahstubbs
Copy link
Collaborator

merged! thanks for the contribution @hydrosquall and the review @enjalot 📈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants