-
Notifications
You must be signed in to change notification settings - Fork 322
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
Dependency sizes #569
Comments
@kanadaj, is this a Webpack and Vue setup? I recommend you to check https://www.amcharts.com/docs/v4/tutorials/preventing-vue-js-from-loading-external-libraries/ if that is the case. You could try to set externals as in |
@darlesson what about Angular 2+ setups? |
Angular uses Webpack. Before it was possible to eject webpack.config.js file, but that is no longer possible. Still we need to modify webpack's configuration file to be able to exclude these files. One possible option is to use ngx-build-plus. You can follow their instructions and add the webpack.extra.js file with the following content:
|
I succeeded in excluding What should I do? |
They are already optional, and will only be loaded when they are actually used. @genichiro Is pdfmake a separate file, or is it included in the bundle? Judging from your screenshot, it looks like it is in a separate If it is a separate file, you can safely ignore it, because it will only be loaded when it is actually used. You can use the browser's developer tools to verify that the |
@genichiro I tried few solutions and I could find just one that works by removing PDFMake from the regex and using a
|
@darlesson awesome, works like a charm, thank yoouuuuu |
Is there any news on how to make this work with |
@eliashdezr With Angular, it does not load the files if they aren't used, so it already works just fine. You can verify this in the browser's dev tools (specifically, the Network tab). |
@Pauan Would it be possible to create a build without |
Agree, pdf export is not a basic feature that should be bundled and imported by default, it is really annoying to deal with it while developing. |
This is the only thing blocking me from upgrading our website to webpack 4, any updates? |
How about this solution proposed earlier in this thread? |
@erictuvesson If you're getting compile errors, that's a bug and you should report it. There shouldn't be any negative effects at all (except maybe for increased compile time). As for a separate build, you can always use the @eliashdezr It's not any different from how we handled exporting in V3: it creates a separate file which is auto-loaded only when needed. Could you explain more about how it's affecting your development? Maybe we can improve that. |
FYI, Webpack tutorial updated: |
@martynasma That didn't work the last time we tried to solve it (5 months ago), but it still doesn't solve my compiler error. :( @Pauan With the upgrade to webpack 4 babel was removed and amcharts is using babel for the experimental dynmaicImport. I could add back babel, but that includes adding a new loader etc, seems like a lot of steps to just get amcharts working with webpack 4. Unfortunately I am using Typescript so I can't just switch to use |
Make sure you're using a
No, we have never required or used Babel. Webpack has built-in support for It sounds like you are running into this Webpack bug. We have a section at the top of our Webpack tutorial which explains how to workaround this bug.
Right, losing types is not fun. You can use things like As for more comprehensive typings for |
It doesn't seem like I did some changes to my webpack config and added babel and it works now. Thanks for the help! |
Thank for @martynasma answer, it's work for me |
Config that worked for me:
|
Success with ngx-build-plus in Angular 9. I followed steps 2, 3, and 5 from the Getting Started section. Reminder to get the right version. However, I needed to use the regex/function approach to get canvg and pdfmake to be properly excluded. Otherwise, only xlsx was being excluded. My final
|
Hi, I have installed amchart4 and in webpack config file added external function as follows;
I have another npm package xlsx (https://www.npmjs.com/package/xlsx) in the app for exporting purpose. This is the what it looks like now, i just wanted to remove the xlsx only from the amchart package ? |
Anyone know of a rollup solution? |
Try // rollup.config.js
export default {
//...,
external: (id) => /xlsx|canvg|pdfmake/.test(id)
}; |
AmCharts 4 seems to have some ridiculously huge dependencies such as pdfmake and xlsx - could you make these optional? AmCharts 4 is already huge, and these libraries don't seem necessary...
The text was updated successfully, but these errors were encountered: