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

Remove "babel" field in package.json for react-native support #266

Closed
wants to merge 2 commits into from
Closed

Remove "babel" field in package.json for react-native support #266

wants to merge 2 commits into from

Conversation

Piroro-hs
Copy link

React-native-packager try to use babel config in package.json or .babelrc and throw "Unknown plugin" error.
This PR will solve this issue and allow using stampit with react-native.

facebook/react-native#4062
react-native TransformError when requiring a node_module that has a package.json with a babel config that specifies uninstalled plugin (stackoverflow)

@koresar
Copy link
Member

koresar commented Oct 18, 2016

Wow. Awesome!
We had to put all that code for a reason probably not relevant anymore.
Let me test it back and forth. There might be caveats.
Will publish ASAP.

Cheers

@danielkcz
Copy link
Contributor

Looks good to me as well. I remember (although bit foggy) that we had to do it like this because of ES2015 preset transpiling those ES modules and babel-preset-es2015-rollup wasn't working that well.

It's bit problematic, that build might actually pass, but don't have exactly tools to automatically verify that those builds are really working properly.

@koresar
Copy link
Member

koresar commented Oct 18, 2016

First of all, thank you very much @Piroro-hs for that cool deep techy contribution.

I checked the final resulting bundle.

  1. The new bundle now has this code:
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? 
function (obj) { return typeof obj; } : function (obj) { return obj && 
typeof Symbol === "function" && obj.constructor === Symbol && 
obj !== Symbol.prototype ? "symbol" : typeof obj; };

which replaces the typeof used in the isObject() and isPlainObject(). It's done to support symbols I assume.
AFAIK we don't need Symbols support in these two methods.

  1. The second issue is that the code above is repeated twice, which increases bundle size for no gain.

Is there a way to get rid of that "symbol" support in those functions?

P.S.
Again, this happened again! Bloody ES6, bloody babel, bloody transpiling! I wanna my ES5 days back!
I'm certain that if the code was ES5 from the beginning we won't ever need PR's like that. :)

@danielkcz
Copy link
Contributor

Babel is obviously over complicated, let's check out Bublé :) #267

@koresar
Copy link
Member

koresar commented Oct 19, 2016

It would be great is React-native-packager would behave same as node.js - use the main file from package.json.

I'm liking the Buble approach very much. @Piroro-hs would #267 resolve your issue?

@Piroro-hs
Copy link
Author

Piroro-hs commented Oct 19, 2016

I've just tried the #267 repo and it works perfectly!(^^)

@koresar
Copy link
Member

koresar commented Oct 19, 2016

Great! Closing this one. :)

@koresar koresar closed this Oct 19, 2016
@koresar
Copy link
Member

koresar commented Oct 19, 2016

@Piroro-hs published stampit v3.0.4
😃

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