Skip to content

feat: add pure bundle build #489

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

Merged
merged 1 commit into from
Sep 26, 2019
Merged

feat: add pure bundle build #489

merged 1 commit into from
Sep 26, 2019

Conversation

kentcdodds
Copy link
Member

What: Adds a "pure" build for bundling with rollup (and parallelizes all build scripts)

Why: Closes #486

How: Used the environment variables supported by the kcd-scripts rollup config: https://github.com/kentcdodds/kcd-scripts/blob/bd3c762c0202ac3564bb6a329e3e9e972795b5e7/src/config/rollup.config.js so we can make the pure.js file an entry and set the output filename suffix (so it doesn't overwrite the existing build).

Checklist:

  • Documentation added to the
    docs site N/A. I don't think the UMD is something we really document or need to honestly.
  • Tests N/A
  • Typescript definitions updated N/A
  • Ready to be merged

@codecov
Copy link

codecov bot commented Sep 23, 2019

Codecov Report

Merging #489 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #489   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines          94     94           
  Branches       15     15           
=====================================
  Hits           94     94

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0149e8...147393f. Read the comment docs.

@eps1lon
Copy link
Member

eps1lon commented Sep 24, 2019

This doesn't work since @testing-library/react/pure uses

// ./pure.js
// makes it so people can import from '@testing-library/react/pure'
module.exports = require('./dist/pure')

May I ask why you don't use .browserslistrc for non-webpack and non-rollup builds? I guess this would require work for some of your packages that still use a browserslist version that don't support node entries?

@kentcdodds
Copy link
Member Author

I don't want to compile async/await for the majority of use cases (people running tests in a recent version of node with jsdom). I think that it's reasonable to expect people to do extra work for the edge case:

import {render} from '@testing-library/react/dist/@testing-library/react.pure.esm.js'

If that's annoying enough, someone could make another module in their project that they import:

// react-testing-library.js
export * from '@testing-library/react/dist/@testing-library/react.pure.esm.js'
export default from '@testing-library/react/dist/@testing-library/react.pure.esm.js'

and then

import {render} from './react-testing-library'

@eps1lon
Copy link
Member

eps1lon commented Sep 25, 2019

version of node with jsdom). I think that it's reasonable to expect people to do extra work for the edge case:

Older browser support is not an edge case. It's directly in line with

Interact with your app the same way as your users

My users don't use jsdom. They use a browser. And 2% of global users and more importantly 25% of screen reader users still use IE 11. I'll already do the extra work in making this runnable in a browser but waving this off as an "edge case" is a bit concerning. Especially if all the reason given for not compiling async/await is

I don't want to

If that's annoying enough, someone could make another module in their project that they import:

I'll do that as well. If I was only concerned with my projects I wouldn't have opened this. I wanted to make this work as easy as possible for any @testing-library/react user.

I'm fine with having multiple bundles for various targets and happy with this change. Me personally I would make the bundle for older targets the default. Would like to hear some other opinions though.

@kentcdodds
Copy link
Member Author

I want to have the common-case be the default. Considering this library has been available for a very long time available at the current level of compilation and this is the first time we're hearing anyone want this tells me that the common case is definitely not to compile/polyfill things further.

@kentcdodds kentcdodds merged commit 594f858 into master Sep 26, 2019
@kentcdodds kentcdodds deleted the pr/pure-build branch September 26, 2019 23:03
@kentcdodds
Copy link
Member Author

🎉 This PR is included in version 9.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@eps1lon
Copy link
Member

eps1lon commented Sep 27, 2019

Considering this library has been available for a very long time available at the current level of compilation

async-await only got added recently. You can't consider the full time frame if the IE 11 target never would have had any effect.

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

Successfully merging this pull request may close these issues.

/pure build throws in browsers not supporting async-await
2 participants