Skip to content

Conversation

mattbague
Copy link

Main reason for this change is to transpile ES6 code. I noticed you guys had babel presets/plugins defined in the package.json so I was hoping they were intended to be used.

Note that this does make the final file generated bigger (40K to 112K). This can be reduced to 48K if you don't need the following babel plugins applied:

  • istanbul
  • transform-class-properties
  • transform-react-remove-prop-types

This change would help fix an issue with a project we're working on. Our current test infrastructure doesn't like ES6 code sadly :(

Thanks!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.15% when pulling 7716f08 on mattbague:master into d530b51 on dowjones:master.

@mrchief
Copy link
Collaborator

mrchief commented Jun 20, 2018

Thanks for reporting this.

The settings defined in package.json are for ava and do not participate in webpack compilation. webpack compilation reads the settings from .babelrc which is suppose to transpile to ES5 codebase.

The existing babelrc has similar options to your changes except for ["es2015", { "modules": false }] (and ignoring prop-types removal).

Would you be able to share some specific errors or details as to what exactly is failing and how?

I've been planning to support ES6 (via jsnext:main) and ES5 by creating separate builds. So maybe what you share will help there as well.

@mattbague
Copy link
Author

mattbague commented Jun 22, 2018

Ahh I see. What we were seeing was when we got js file from this URL: https://unpkg.com/react-dropdown-tree-select@1.12.0/dist/react-dropdown-tree-select.js

It had this line: const n=e.filter(t); So the use of const was causing us some issues since that was introduced in ES6.

Yeah two separate versions of the build sounds like a good plan. No worries. Feel free to close this, we can just have a hardcoded copy locally with that little change.

@mrchief
Copy link
Collaborator

mrchief commented Jun 22, 2018

const is supported in all current browsers. Are you using IE10 or below or similar browser?

@mattbague
Copy link
Author

Yeah, our test framework is targeting an old browser version which is likely the cause of the error we were seeing.

@mrchief
Copy link
Collaborator

mrchief commented Jun 23, 2018

Hmm. To keep code bloat to a minimum, I try to support only current browsers. The separate builds will still not help in your case unless I target lower browsers.

I wonder how your changes fixes this issue though. es2015 preset doesn't transform const to var unless you add more plugins.

What browser are you using?

@mattbague
Copy link
Author

Looked into it a bit more and figured out that it's the classnames dependency that's causing the problem. I'm just gonna close this pull request out.

@mattbague mattbague closed this Jun 27, 2018
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.

3 participants