Webpack 2 with new AureliaPlugin cannot find module at runtime

I am using a candidate for the release of the new Aurelia Webpack plugin designed to work with Webpack 2.

I worked and worked before the build, but when I run, I get this error:

Unable to find module with identifier: \ "views / nav-bar / nav-bar-vm \"

Following I nstructions for debugging this , I started webpack with --display-modules. This gave a long list of modules in which it was:

[views / nav-bar / nav-bar-view.html] ./ src / views / nav-bar / nav-bar-view.html 2.44 kB {0} [built] [ views / nav-bar / nav-bar -vm ] ./ src / views / nav-bar / nav-bar-vm.ts 1.36 kB {0} [built]

I highlighted the module name. This is the place in the match (unless it should contain quotation marks ...)

All debugging tips don't say what to do when I get this error and the value matches ...

The only non-standard thing I'm doing is changing how the views are mapped to view models using this code:

ViewLocator.prototype.convertOriginToViewUrl = (origin) => {
    let moduleId = origin.moduleId;


    // see if the module ends in 'Vm'
    if (moduleId.endsWith('-vm')) {
        var coreName = moduleId.substring(0, moduleId.length - 3);
        return coreName + '-view.html';
    } else {
        return moduleId + '.html';
    }
};

I do not understand how to get through this error. If someone knows how I will like some help!

Update:
Here is a link to my webpack.config.js file if it can help with this problem:

+6
source share
1 answer

Turns out the problem was in my file webpack.config.js.

I had my html downloader twice. The second called an additional set of quotes, which will be placed around the module identifier.

, .

+1

Source: https://habr.com/ru/post/1016224/


All Articles