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

import testing-library/dom from npm instead of unpkg #65

Closed
smeijer opened this issue May 29, 2020 · 10 comments · Fixed by #96
Closed

import testing-library/dom from npm instead of unpkg #65

smeijer opened this issue May 29, 2020 · 10 comments · Fixed by #96
Labels
chore help wanted Extra attention is needed

Comments

@smeijer
Copy link
Member

smeijer commented May 29, 2020

This comment needs to be fixed:

quoting for issue indexing:

This is not the way I want it to be, but I can't get '@testing-library/dom'
to build with Parcel. Something with "Incompatible receiver, Map required".
It works when running parcel in dev mode, but not in build mode. Seems to
have something to do with a core-js Map polyfill being used?
It's now loaded from unpkg.com via ./index.html

https://github.com/smeijer/testing-playground/blob/958a46b4be8520045908ac1d20de8236e45409f5/src/parser.js#L5-L16

@smeijer smeijer added help wanted Extra attention is needed chore RFC and removed help wanted Extra attention is needed labels May 29, 2020
@smeijer
Copy link
Member Author

smeijer commented May 30, 2020

Actually, I think I've changed my mind.

Fetching it from unpkg gives us an advantage. It will allow us to add an option to switch the version of testing-library that's being used.

@marcosvega91 & @MichaelDeBoey, what do you guys think?

@marcosvega91
Copy link
Member

I like the idea, can be interesting

@MichaelDeBoey
Copy link
Member

Being able to switch the version could be helpful to test possible bugs with, but I'm not sure if we should make this available tbh.
I think we should help strive towards pushing the newest version.

@Siemko
Copy link
Contributor

Siemko commented Jun 1, 2020

I hope this helps a bit, in my opinion testing-playground should always aim for the newest version of testing-library. I think it aims to be the guiding light, and we want it to point to the best possible direction. @MichaelDeBoey here is right.

@smeijer
Copy link
Member Author

smeijer commented Jun 1, 2020

Some help in fixing the issue would be most welcome 😇

@smeijer smeijer added help wanted Extra attention is needed and removed RFC labels Jun 1, 2020
@Siemko
Copy link
Contributor

Siemko commented Jun 2, 2020

I'll have a look after my working hours 👀

@smeijer
Copy link
Member Author

smeijer commented Jun 2, 2020

I'll have a look after my working hours 👀

Thanks. That would be awesome!

@Siemko
Copy link
Contributor

Siemko commented Jun 2, 2020

This one's nasty. Generally speaking, parcel uses core-js@3 from @babel/runtime-corejs3 to provide all the polyfills. Of course map polyfill is not a Map, and there is some checking done. I was trying to play with babel configuration, I can change some settings, but it seems like @babel/runtime-corejs3 is always applied by parcel.

What I know by now:

  1. Parcel's not taking .babelrc into consideration during build unless "env" option is specified
  2. Providing
"presets": [
    ["@babel/preset-env", { "corejs": false }],
    "@babel/preset-react"
  ],
"plugins": [["@babel/plugin-transform-runtime", { "corejs": false }]],

to both .babelrc root and env.production has no influence on how parcel transforms it.

I'm confused, will keep on working this out tomorrow.

@smeijer
Copy link
Member Author

smeijer commented Jun 2, 2020

Yeah, what I remember from another project of mine, is that parcel does do something "smart" with browserslists.

I think we need to write a browserslist file to the testing-library folder before build (or post install)

Also see here: parcel-bundler/parcel#1655 (comment)

If that doesn't work, we have a few options left.

  • open an issue at parcel-bunder
  • fix the issue in testing lib
  • add testing lib as git sub module

The last one is really least preferable in my opinion.

@smeijer
Copy link
Member Author

smeijer commented Jun 4, 2020

The issue lies within aria-query, but so far I've been unable to get it to work. I've filed an issue in the parcel repo: parcel-bundler/parcel#4692

I've also posted the smallest possible reproduction case there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants