# Bundle plugin with webpack

**URL:** <https://discourse.aurelia.io/t/bundle-plugin-with-webpack/918>\
**Category:** Uncategorized\
**Created:** [March 17, 2018, 7:35pm UTC](https://discourse.aurelia.io/t/bundle-plugin-with-webpack/918 "2018-03-17T19:35:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbockle](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jbockle/32/607_2.png) [@jbockle](https://discourse.aurelia.io/u/jbockle)\
**Post date:** [March 17, 2018, 7:35pm UTC](https://discourse.aurelia.io/t/bundle-plugin-with-webpack/918/1 "2018-03-17T19:35:13Z")

</div>

is it possible to bundle an aurelia plugin with webpack to dynamically include it in an aurelia app using webpack?

---

<div class="post-metadata">

**Author:** ![Alexander-Taran](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/alexander-taran/32/2308_2.png) [@Alexander-Taran](https://discourse.aurelia.io/u/Alexander-Taran)\
**Post date:** [March 18, 2018, 9:18am UTC](https://discourse.aurelia.io/t/bundle-plugin-with-webpack/918/2 "2018-03-18T09:18:36Z")

</div>

Start from this [comment on github issue](https://github.com/aurelia/webpack-plugin/issues/99)

> If you want to load arbitrary plugins that are unknown at build-time… that’s your worst case. Webpack is actually not a loader and you’ll have to come up with your own solution to load unknown files at runtime. Webpack is only a bundler and can only handle stuff that is known a build time.

---

<div class="post-metadata">

**Author:** ![MaximBalaganskiy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/maximbalaganskiy/32/831_2.png) [@MaximBalaganskiy](https://discourse.aurelia.io/u/MaximBalaganskiy)\
**Post date:** [March 19, 2018, 11:03pm UTC](https://discourse.aurelia.io/t/bundle-plugin-with-webpack/918/3 "2018-03-19T23:03:27Z")

</div>

@jbockle please elaborate what you mean by “dynamically include”

If you want to load a random plugin at runtime then no, webpack cannot do that and you’ll have to go to JSPM. Although, I speculated about this awhile ago. You can probably create a bundle which will consist of a root file that you reference in `index.html` and a chunk file loaded dynamically on demand.

If your goal is to minimise traffic and only load what is used then yes, webpack can create chunks. By calling `PLATFORM.moduleName` with a second parameter you can move views and resources to a dynamically loaded chunk.
