# Dynamic import, within an addon, of an addon file?

**URL:** <https://discuss.emberjs.com/t/dynamic-import-within-an-addon-of-an-addon-file/19587>\
**Category:** Questions\
**Created:** [June 22, 2022, 9:10pm UTC](https://discuss.emberjs.com/t/dynamic-import-within-an-addon-of-an-addon-file/19587 "2022-06-22T21:10:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattmcmanus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/mattmcmanus/32/13776_2.png) [@mattmcmanus](https://discuss.emberjs.com/u/mattmcmanus)\
**Post date:** [June 22, 2022, 9:10pm UTC](https://discuss.emberjs.com/t/dynamic-import-within-an-addon-of-an-addon-file/19587/1 "2022-06-22T21:10:10Z")

</div>

Hello!

I have an add-on that wraps a rather large package. Dynamically importing that package is working as expected. I’m interested in dynamically importing a file within my addon that imports and configures a class exported from the package.

I have the code setup:

```javascript
// `@org/scheduler` is the package name
// `views/audits/schedule` is the location of the file within /addon
this.AuditScheduleClass = (
    await import('@org/scheduler/views/audits/schedule')
).default;

```

I should also note that the file itself is a typescript file.

It looks as if `ember-auto-import` is not generating the dynamic import for that file. I imagine it’s skipping it because of some dependency/devDependency rule? Has anyone else done this?

Also, does doing this actually get me any bundle savings? Does ember-cli just gobble up everything within addon and add it to the vendor payload anyway?

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![NullVoxPopuli](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/nullvoxpopuli/32/18691_2.png) [@NullVoxPopuli](https://discuss.emberjs.com/u/NullVoxPopuli)\
**Post date:** [June 25, 2022, 9:29pm UTC](https://discuss.emberjs.com/t/dynamic-import-within-an-addon-of-an-addon-file/19587/2 "2022-06-25T21:29:13Z")

</div>

> [@mattmcmanus](#):
>
> It looks as if `ember-auto-import` is not generating the dynamic import for that file.

can you expand on this? how do you know?

> [@mattmcmanus](#):
>
> does doing this actually get me any bundle savings?

it might not – it ends up being a webpack (or whatever packager)'s decision about whether or not it makes sense to bundle that file or not – and it wouldn’t come in to play at all unless the consuming app is using embroider in full strict mode (or if your addon is a v2 addon)
