Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Allow payment app to use treeshaking on paragon #48

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

davidjoy
Copy link
Contributor

@davidjoy davidjoy commented Jul 3, 2019

This PR does a few things which are pre-requisites for treeshaking external libraries like paragon. Note, paragon is our only reusable component repo that will currently be treeshooken. (Yes, that's a word.) In the future, the header and footer will get the same treatment.

This PR also does a few things that aren't strictly related. Those are listed below.

To be able to use treeshaking with paragon:

  • Update @edx/paragon to version 6.x. Anything earlier won't work. If you're not already on v4.x, this may mean you need to consume other breaking changes. NOTE: v5 is the same as v6 - we had a semantic-release snafu.
  • Convert .babelrc to babel.config.js. This is so that your jest tests will continue to work.
  • Upgrade to babel v7. You can see the changes necessary to do this in this PR's package.json diff.
  • Update jest and babel-jest to the latest version.
  • Be sure to add paragon to the transformIgnorePatterns line. This allows jest to run paragon through babel. Jest needs this so that there won't be any import statements in the code by the time it tries to run it in node.
  • If you're using PurgeCSS, makes sure it's only looking through the 'dist' directory in paragon. Otherwise it may never come back/finish, as it'll crawl the entire node_modules/@edx/paragon/node_modules directory.

Unrelated to treeshaking paragon:

  • DRYing up our webpack configs.
  • We moved our browserslist from the babel config to package.json because the former is deprecated.
  • Added babel-polyfill to the tests because it needed regenerator-runtime.

Also DRYing up our webpack configs.
@davidjoy davidjoy requested a review from a team July 3, 2019 16:33
@davidjoy davidjoy merged commit 2a1e28d into master Jul 3, 2019
@davidjoy davidjoy deleted the djoy/never_shake_a_paragon branch July 3, 2019 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants