-
Notifications
You must be signed in to change notification settings - Fork 525
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
Provide es6 build to use with Webpack 2 #256
Provide es6 build to use with Webpack 2 #256
Comments
@okonet -- We've already audited victory to make sure there are no multiple export includes (which means there shouldn't be any DCE opportunities via tree shaking) aside from like However, if you want to build off the es6 source, just use webpacks alias: {
victory: require.resolve("victory/src")
} And now you have ES-next source. From there, just make sure your webpack 2 / babel config has the needed / analogous parts of:
And you're building from source! ( @boygirl -- Might be nice to document this and consider adding a |
I'm a bit concerned about the API here, since doing one-off includes will require lots of changes in my source code. Right now there is no way I could replace import { VictoryAxis, VictoryArea } from 'victory' with something like import VictoryAxis from 'victory/lib/VictoryAxis'
import VictoryArea from 'victory/lib/VictoryArea' since import VictoryAxis from 'victory/lib/components/VictoryAxis'
import VictoryArea from 'victory/lib/components/VictoryArea' and this will break in case the internals of the library would change in the future. This is why I'm looking for a more robust way to do so. Ideally without rewriting my code (computers should suffer instead of developers). More to say, there are different packages for different types of visualizations + some core components that require a deep knowledge of the lib structure to use in an optimal way. I'm wondering if this is something you have on your radar or you don't consider this an issue. |
We'll look into better support for building from es6 source. In the meantime, you might be able to shave off some size by including the |
Yep, importing individual packages you use will likely shave off bytes. And you should be able to build our raw ES sources straight up with a little bit of webpack and Babel work. I look forward to hearing back how that experiment goes if you choose to do so. |
@okonet -- To help our future planning, what would be the most useful enhancement for you?
Thanks! |
Thanks for the responses! @boygirl I'm using the pie as well, but not all charts (only area one). So for me it would make sense to ony import these 2 charts. I've been using animation module but had to remove it from the code until #248 is fixed. So, in order to import these 3 modules ATM I have to install 3 different dependencies and import using internal dir structure, which is not optimal IMO. This makes me think that in terms of DX, the distribution bundle (even with CommonJS modules) would be a huge improvement over the current state. For the long(er)-term, I think |
I'm running into a similar problem where I only want to use |
@icd2k3 -- And you've tried |
thanks for the quick response @ryan-roemer! Looks like a lot of lodash is being included too... 182kb, but I can live with that for now. |
@boygirl -- I think we might finally be at the point of ticketing out for all victory repos:
And I can help with all of this work. Let me know if you want me to script stuff with |
Here's a breakdown of the file size imports I'm seeing: For me, looks like Overall been loving Victory - thanks for the hard work! |
I believe lodash bundle size is already optimized as of FormidableLabs/builder-victory-component#59 and FormidableLabs/builder-victory-component#62 |
Thanks @okonet, you're correct. I was able to shave off some of that lodash size from my own build by resolving victory-core and victory-pie to just use the same version of lodash. Everything's looking good now and I'm happy with the import size. That said, I plan on updating to webpack2 soon and @ryan-roemer's post above sounds interesting. |
I've been using webpack 2 but it does not bring a lot in terms of size until more libraries will export es6 sources. |
Consider using https://github.com/facebook/react-native/tree/master/babel-preset as the base preset to have consumers need to require themselves in root Ideally we don't have any webpack dependencies (although /cc @jevakallio |
I'm using Webpack 2 on https://status.postmarkapp.com and would like to reduce the bundle size of the production bundle. ATM there is no easy way to use webpack's tree-shaking since vicotry code get's transpiled to es5 and commonjs.
In the meantime, is there a way to minimize bundle size with CommonJS?
The text was updated successfully, but these errors were encountered: