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

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 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.

None yet

2 participants