# Webpack Chunk Issue With Dialog ViewModel

**URL:** <https://discourse.aurelia.io/t/webpack-chunk-issue-with-dialog-viewmodel/1337>\
**Category:** Help Requests\
**Created:** [June 12, 2018, 8:08pm UTC](https://discourse.aurelia.io/t/webpack-chunk-issue-with-dialog-viewmodel/1337 "2018-06-12T20:08:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkever](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/rkever/32/145_2.png) [@rkever](https://discourse.aurelia.io/u/rkever)\
**Post date:** [June 12, 2018, 8:08pm UTC](https://discourse.aurelia.io/t/webpack-chunk-issue-with-dialog-viewmodel/1337/1 "2018-06-12T20:08:55Z")

</div>

My setup:

- Webpack 4 (not using CLI)
- Latest Aurelia (as of april)

For dev and release I’m using the below webpack plugins…

```auto
plugins: [
    new UglifyJSPlugin({
        sourceMap: true
    }),
    new CompressionPlugin ({
        algorithm: 'gzip'
    })
]

```

I’m using webpacks split chunk feature which works great. I have a view that is chunked via the routes and inside that view I’m importing a viewmodel I’m going to use for a dialog. When I’m running webpack in local mode `--env local` everything works fine. However, when I change from local to either dev or release `--env release` aurelia complains that it’s missing the moduleid as if the module is not loaded in the chucked file. Now, I can use `PLATFORM.moduleName` ONLY using the full path–not relative–and it will work in local, dev, and release environment modes. Has anyone else run across this issue at all???

```auto
import { inject, bindable, observable } from 'aurelia-framework';
import { DialogService } from 'aurelia-dialog';
import { MyDialog } './my-dialog'; // works in local mode only

@import(DialogService)
export class MyView {
     constructor(dialogService) {
        this.dialogService = dialogService;
    }

    myMethod(){
         this.dialogService.open({ viewModel: MyDialog }); // works in local mode only
         this.dialogService.open({ viewModel: PLATFORM.moduleName('full/path/to/my-dialog')}); // works in any mode; local, dev, and release ONLY with full path, not with relative path
    }
}

```

---

<div class="post-metadata">

**Author:** ![rkever](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/rkever/32/145_2.png) [@rkever](https://discourse.aurelia.io/u/rkever)\
**Post date:** [June 12, 2018, 8:48pm UTC](https://discourse.aurelia.io/t/webpack-chunk-issue-with-dialog-viewmodel/1337/2 "2018-06-12T20:48:36Z")

</div>

I think this [issue](https://github.com/aurelia/webpack-plugin/pull/139) may resolve it when it’s checked in.
