# Unhandled rejection getViewStrategy

**URL:** <https://discourse.aurelia.io/t/unhandled-rejection-getviewstrategy/2024>\
**Category:** Help Requests\
**Created:** [December 13, 2018, 12:02pm UTC](https://discourse.aurelia.io/t/unhandled-rejection-getviewstrategy/2024 "2018-12-13T12:02:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuzmycz](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/kuzmycz/32/1245_2.png) [@kuzmycz](https://discourse.aurelia.io/u/kuzmycz)\
**Post date:** [December 13, 2018, 12:02pm UTC](https://discourse.aurelia.io/t/unhandled-rejection-getviewstrategy/2024/1 "2018-12-13T12:02:28Z")

</div>

I have built my application and then deployed it to S3. The application works fine until I perform an operation that uses the aurelia dialogs. The error I get is

> Unhandled rejection getViewStrategy

Is there a work around to get the dialog to work?

Regards,  
Mark.

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [December 13, 2018, 12:25pm UTC](https://discourse.aurelia.io/t/unhandled-rejection-getviewstrategy/2024/2 "2018-12-13T12:25:10Z")

</div>

I guess you are using webpack, and use the dialog `open` API in the following way:

```auto
import { SomeDialogViewModel } from './some-module';

export class SomeCustomElement {
  // ...
  confirm() {
    dialogService.open({
      viewModel: SomeDialogViewModel
    })
  }
}

```

if so:

Why the error happens at production time, but not during development is because in development build, modules origins (can be understood as module path) are preserved, so `aurelia-webpack-loader` is able to figure out the origin of dialog view model module, and so is corresponding view. In production build there are some more work related to module mangling in webpack that makes `aurelia-webpack-loader` no longer able to figure out the view model origin.

You have 2 options:

1. Instruction Webpack to not concatenate the module, via `PLATFORM.moduleName`:

```auto
import { SomeDialogViewModel } from './some-module';

PLATFORM.moduleName('./some-module');

export class SomeCustomElement {
  // ...
  confirm() {
    dialogService.open({
      viewModel: SomeDialogViewModel
    })
  }
}

```

1. Explicitly tell where the view of `SomeDialogViewModel` is, either via import `.html`:

```auto
import { view } from 'aurelia-framework';
import DIALOG_VIEW from './some-dialog.html';

@view({
  template: DIALOG_VIEW,
  /* dependencies: () => []*/
})
export class SomeDialogViewModel {

}

```

or using `useView` decorator, with `PLATORM.moduleName`

```auto
import { useView } from 'aurelia-framework';

@useView(PLATFORM.moduleName('absolute/path/to/some-dialog.html'))
export class SomeDialogViewModel {

}

```

Can you try the above suggestion?

---

<div class="post-metadata">

**Author:** ![kuzmycz](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/kuzmycz/32/1245_2.png) [@kuzmycz](https://discourse.aurelia.io/u/kuzmycz)\
**Post date:** [December 13, 2018, 1:13pm UTC](https://discourse.aurelia.io/t/unhandled-rejection-getviewstrategy/2024/3 "2018-12-13T13:13:25Z")

</div>

Option 1 worked fine. I haven’t tried option 2 yet; however, adding the modal view to the global resources also works.

Regards,  
Mark.
