-
-
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
@inlineView dependencies not bundled #107
Comments
Sorry, I just changed that component to an html/js pair. |
Yes indeed. Not sure how to handle that, probably evaluate the string parameter of |
Btw. after using moduleName it seems like all the custom elements are bundled but no custom attributes. Here's a screen of the trace output from @eikaramba in the issue mentioned above: These are all custom elements while attributes like Of course I can create a separate issue for that. |
@Thanood custom attributes are generally registered either:
There is no specific knowledge of custom elements or custom attributes inside the Webpack plugin. |
@jods4 Thank you for your help and sorry for not being precise.. 😃 This is the The For example the useAutoComplete(): ConfigBuilder {
this.globalResources.push('./autocomplete/autocomplete');
return this;
} The This is then loaded as an aurelia plugin.. export function configure(aurelia, configCallback) {
// ...
if (builder.useGlobalResources) {
const mappedResources = builder.globalResources.map(r => PLATFORM.moduleName(r));
aurelia.globalResources(mappedResources);
}
} While this approach seems to work for custom elements as well as html-only components, it seems to fail for custom attributes (f.i. the Of course I may have done something wrong but I don't see it. 😃 Just in case you want to try it yourself: This version is not yet published on I will try this again if I have some more time. 😃 |
You can't
You should wrap the strings when you push them: this.globalResources.push(PLATFORM.moduleName('./autocomplete/autocomplete')); Caveats:
That second point is implied by the fact that bundle contents are determined at build-time and there's no way Webpack can analyze JS to determine what code will run or not (so it assumes everything runs and every If your goal is to be able to include in the bundle just the modules that are used, you'll need alternative strategies. One way is to repeat the configuration in the webpack config. Ultimately you'll want: new ModuleDependenciesPlugin({
'aurelia-materialize-bridge': ['./autocomplete/autocomplete', /* parts you actually use */ ]
}) This is how Aurelia does it for Another way could be to have each import { resources } from 'aurelia-materialize-bride';
resources.push(PLATFORM.moduleName('./autocomplete/autocomplete')); And then ask users to create a module that lists what they want to use: import "aurelia-materialize-bridge/autocomplete";
import "aurelia-materialize-bridge/..."; // etc. Since Webpack traces dependencies precisely, only the required modules end up included. |
@jods4 Thanks a lot for the thorough explanation. 👍 I need to think about that because it's potentially changing my structure or even install process. Isn't it interesting that it actually works with custom elements? |
It is surprising! Maybe they're referenced by another mean? |
Not that I know of.. |
RC-3 contains code that tries to detect resources inside The configuration (which tags/attributes) is shared with |
I guess this is definitely a webpack-plugin issue ;)
In aurelia-materialize-bridge one of the view components is using an @inlineView Template which requires a css file (see this issue aurelia-ui-toolkits/aurelia-materialize-bridge#401 and here the code https://github.com/aurelia-ui-toolkits/aurelia-materialize-bridge/blob/master/src/slider/slider.js)
Unfortunately the slider.css dependency is not bundled, is that not handled yet?
The text was updated successfully, but these errors were encountered: