forem-browser-extension icon indicating copy to clipboard operation
forem-browser-extension copied to clipboard

Add parcel to the project

Open nickytonline opened this issue 4 years ago • 7 comments

Parcel is web application bundler that out of the box has zero configuration.

Although we use webpack in the forem code base, it would be nice to consider a different more modern bundler. The main reason we use webpack in the Forem code base is because of it's integration with Rails via webpacker. It also ships with Rails 6.

In browser extension land, we do not have this constraint.

I have a proof of concept that I will post sometime this week as a draft PR to show how it all comes together.

Some benefits of adding a bundler to the extension code base:

  • ES modules
  • minification
  • hot reloading

Let us know what you think about using Parcel.

nickytonline avatar Aug 10 '20 19:08 nickytonline

hot reloading

Do we get to make use of this in a browser extension context?

benhalpern avatar Aug 10 '20 22:08 benhalpern

hot reloading

Do we get to make use of this in a browser extension context?

We should be able to. I've done this in the past with webpack. It's not a deal breaker if we can't though. The other two benefits are already a good enough reason to go with it.

nickytonline avatar Aug 11 '20 04:08 nickytonline

I'm conflicted about this but also don't feel strongly about either choice.

I wonder if uniformity here wouldn't help us regarding code contribution and collaboration in the long run.

By having two sets of bundlers we require contributors to learn both Webpack and Parcel. It also true that the people contributing to Forem's server might not be the same set of people contributing to the browser extension and being nimble on JS bundle configuration might help us in the long run.

So, +1 on either choice.

rhymes avatar Aug 11 '20 04:08 rhymes

By having two sets of bundlers we require contributors to learn both Webpack and Parcel.

The good thing about Parcel is that there's basically nothing to learn, which is part of the appeal. But you do make a good point re uniformity. I'm fine either way.

citizen428 avatar Aug 11 '20 05:08 citizen428

hot reloading

Do we get to make use of this in a browser extension context?

I think to auto reload chrome extension during development you might want to use something like this https://chrome.google.com/webstore/detail/extensions-reloader/fimgfedafeadlieiabdeeaodndnlbhid

Rafi993 avatar Aug 13 '20 02:08 Rafi993

You can actually use parcel's watch to handle this. There is an example of this in https://github.com/ceoimon/react-parcel-ts-extension-boilerplate/blob/master/package.json

I'll have a proof of concept up tomorrow latest Friday.

nickytonline avatar Aug 13 '20 02:08 nickytonline

You can actually use parcel's watch to handle this. There is an example of this in https://github.com/ceoimon/react-parcel-ts-extension-boilerplate/blob/master/package.json

I'll have a proof of concept up tomorrow latest Friday.

Awesome

Rafi993 avatar Aug 13 '20 03:08 Rafi993