-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat(exoflex): add babel plugin for rewriting imports #341
Conversation
Tested with a fresh expo web project and
|
The
|
@darcien I got a slightly different size from you.
|
Oh, I'm using the master version, with |
I see. Have you test it on an Android bundle and check the APK size? Mine is not changing at all whether I use the plugin or not, it still at EDIT: |
I've tried to build some APKs using All comparison is using No babel plugin:
Using
Using
|
I wonder why using |
Have you tried using |
I haven't tried |
Never mind, found it! |
I forgot to tell you it's only available in this branch because it's a new feature 😆 |
This whole PR is awesome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 it!
const ast = parser.parse(source, { | ||
sourceType: 'module', | ||
plugins: [ | ||
'jsx', | ||
'typescript', | ||
'objectRestSpread', | ||
'classProperties', | ||
'asyncGenerators', | ||
], | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly what I need for the vision-ui source transformer! (although I need to use the typescript parser)
import { Provider as ExoflexProvider } from "exoflex/lib/module/components"; | ||
import { Button } from "exoflex/lib/module/components"; | ||
import { Label } from "exoflex/lib/module/components/Typography"; | ||
import { NonExistent, NonExistentSecond as Stuff } from "exoflex/lib/module/index.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a .js
on the end of this line but not the others?
Mostly a port from the babel plugin in
react-native-paper
.Original file:
https://github.com/callstack/react-native-paper/blob/5870fb3ef5fbb6aeb9aa95db942c1ac009e6a3b0/src/babel/index.js
Tried using it on the example project but can't seem to reduce the bundle size even when deleting some of the imports.