Excluding files in bundled javascript
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [ ] bug report
- [ X] feature request
Command (mark with an x
)
- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [X ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Any Angular Cli
Repro steps
Webpack has a nice feature to generate code for dynamic requires, for example: require(‘@angular/’ + lib); would write code and bundle all @angular packages together. The downside of this feature is that it often includes too much at the same time. There are quite a few node.js libraries that do something like require(‘./i18n/’ + language + ‘.js’) to load the correct i18n. That works nice on a node.js server, but if used with Webpack the bundled output will contain all languages.
As a solution you would need to modify the Webpack configuration to exclude all languages you do not use. However since the Webpack config can not be altered without ‘ng eject’ there is no way for me to exclude javascript from bundling.
Desired functionality
Being able to exclude files from the bundled files to reduce filesize without having to call ng eject.
Mention any other details that might be useful
Example blog: https://bjacobel.com/2016/12/04/highlight-bundle-size/
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Would also be useful for Chart.js, as it includes the whole of Moment, even though it is technically an optional dependency with v2.8: https://github.com/chartjs/Chart.js/pull/5978
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.