Webpack Chunk Issue With Dialog ViewModel


#1

My setup:

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

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

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???

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
    }
}

#2

I think this issue may resolve it when it’s checked in.