-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: dependencies are not tracked with the as-element="compose" attribute #130
Comments
Seems legitimate but given how the html parser (re-used from Webpack) works that might be a bit tricky. I know it does not exactly solve this issue but it might help to know that you can register your own tag/attribute combinations as modules, see https://github.com/aurelia/webpack-plugin/wiki/Managing-dependencies#html-dependencies |
It doesn't sound too difficult to me, but I am using a different html parser. As reference, with htmlparser2, I do let parser = new htmlparser.Parser({
onopentag: function(name, attrs) {
// <require from="dep"></require>
if (name === 'require') {
add(attrs.from);
// <compose view-model="vm" view="view"></compose>
// <any as-element="compose" view-model="vm" view="view"></any>
} else if (name === 'compose' || attrs['as-element'] === 'compose') {
add([attrs['view-model'], attrs.view]);
// <router-view layout-view-model="lvm" layout-view="ly"></router-view>
// <any as-element === 'router-view' layout-view-model="lvm" layout-view="ly"></any>
} else if (name === 'router-view' || attrs['as-element'] === 'router-view') {
add([attrs['layout-view-model'], attrs['layout-view']]);
}
}
}); |
I used the same parser as Webpack to minimize the number of dependencies installed. It calls you back with with one This means you can see But what is worse is that it's the only callback so you can't know if the second call with So basically, it's impossible to support |
That's unfortunate. The parser looks quite small. It might not be too difficult to bring the code in and customize it, but that has risk on introducing bug. Personally I will side to one more dep on |
I'm submitting a bug report
2.0.0-rc.5
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
7.6.0
NPM Version:
4.1.2
JSPM OR Webpack AND Version
webpack 3.8.1
Browser:
all
Language:
TypeScript 2.5.3
Current behavior:
The plugin correctly tracks dependencies for the
<compose view-model="./vs" />
but not for<some-other-tag as-element="compose" view-model="./vm" />
Expected/desired behavior:
It should be possible to use the
as-element
in a similar way as withcompose
directly.The text was updated successfully, but these errors were encountered: