Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

AP-1023 Use rollup to bundle library #149

Merged
merged 3 commits into from
Dec 20, 2019
Merged

Conversation

justinanastos
Copy link
Contributor

@justinanastos justinanastos commented Dec 17, 2019

Contributes to AP-1023

Why

We're going to use a 3rd party tooltip library to manage our tooltips and popovers. All 3rd party tooltip libraries require some CSS be included in the final bundle. Our current bundle process does not allow this because we use tsc.

The solution I've chosen is to use Rollup. Rollup is intended to bundle packages together for consumption. This only builds a CJS build right now, but we can expand this to build a es module package that can be tree shaken automatically later.

Rollup does not support bundling css out of the box; we'll have to use a plugin for that (coming with the associated PR!).

Testing

This is tested by tryin git in AGM. We should find a way to run our test suite against our compiled output files so we can guarantee that everything works. See https://github.com/mdg-private/engine-frontend/pull/1995

rollup.config.js Outdated
function CJS() {
return {
input: [
"src/Button",
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems strange that we'd need to modify our build config every time we add something to src - can we just grab everything in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I made this change. It makes the config a little more confusing, but will be future-proof. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answering your question more directly, we can't grab everything. We have to exclude certain things, but that's fine! We can exclude scripts/ directories, stories, and test files easily.

@justinanastos justinanastos added minor Increment the minor version when merged 🏗 internal and removed minor Increment the minor version when merged labels Dec 20, 2019
@justinanastos
Copy link
Contributor Author

I'm going to merge this in. We can roll back if necessary!

@justinanastos justinanastos merged commit 8fb2532 into master Dec 20, 2019
@apollo-bot2
Copy link
Collaborator

🚀 PR was released in v2.22.0 🚀

@apollo-bot2 apollo-bot2 added the released This issue/pull request has been released. label Dec 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants