aurelia / webpack-plugin

A plugin for webpack that enables bundling Aurelia applications.
MIT License
90 stars 36 forks source link

Karma can't find module when using withResources('module-name') #150

Closed codedbypaul closed 6 years ago

codedbypaul commented 6 years ago

I'm submitting a bug report

Please tell us about your environment:

Also Karma 2.0.2

Current behavior: I've used a simple test setup based on Aurelia Testing Components

Unfortunately I get LOG: 'Error: Unable to find module with ID: my-component' when running the tests.

I've set up a Gist here

If I import the module like so

import MyComponent from 'my-component'

and then use it as .withResources(MyComponent) the test will run.

I've tried using PLATFORM.moduleName('my-component') without success.

Expected/desired behavior:

codedbypaul commented 6 years ago

I noticed when webpack gets my files that the module ID is prepended with the alias I used in webpack.

So withResources('my-component/my-component') works as far as loading the files correctly.

Now trying to figure out why the component isn't rendering. console.log(document) after component.create(bootstrap) only shows

<my-component first-name.bind="firstName"></my-component>

rather than

<div class="firstName">Bob</div>

But I guess that's not really an issue for webpack-plugin.