aurelia / loader-webpack

An implementation of Aurelia's loader interface to enable webpack.
MIT License
26 stars 10 forks source link

File importing child and grandchild fails #3

Closed deitch closed 8 years ago

deitch commented 8 years ago

I have a file a.html that depends on b and c:

  <require from='./b'></require>
  <require from='./c'></require>

b.html also depends on c, so it includes the following:

  <require from='./c'></require>

In this case, if the timing is right, I get an error while importing c:

ERROR [app-router] Error: Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>

The error manifests in aurelia-pal-browser.js in createTemplateFromMarkup, but that is only because it is passed an empty markup parameter to the method.

The core appears to be in WebpackLoader._import. On one call, the result of the require is the actual content of c.html, but on the other, it is just an empty object. That in turn has no <template> child and fails.

The core line appears to be here https://github.com/aurelia/loader-webpack/blob/master/src/index.js#L78

Note that if I run it through a browser debugger and step through each time, then the issue goes away, which implies some kind of timing issue.

deitch commented 8 years ago

I can close this. Turns out it was the Firefox caching issue mentioned earlier and not aurelia or webpack.