aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

After bundling, view models are still pulled from server #134

Closed Jaeiya closed 8 years ago

Jaeiya commented 8 years ago

I was wondering if there was some extra steps that are needed to force the application to use the bundled view model. As it is right now, my about page still makes a server request for the about.js file, instead of using the one bundled into the app-build.js. Now that I'm looking at it, even my app.js file is requested from the server instead of app-build.js. This kinda defeats the purpose of bundling haha.

ss 2016-07-12 at 09 24 41

EisenbergEffect commented 8 years ago

LOL Yes, it should not work that way. It sounds like there's something wrong with your bundle config. Take a look at that and compare it to what we've got in the skeleton project that matches yours. My guess is that you've got an incorrect glob pattern.

Jaeiya commented 8 years ago

Okay, I'll check that out. I tried asking about this on Gitter, but no one is available.

Jaeiya commented 8 years ago

Well I've done everything I can to get this to work and it just won't. The configs match exactly. The aurelia dependencies are working properly, just not the view model scripts.

EisenbergEffect commented 8 years ago

Are your file names and import statements matched in their casing?

Jaeiya commented 8 years ago

Everything is lowercase, though Aurelia seems to be requesting an uppercase About.js page, which doesn't make sense.

EisenbergEffect commented 8 years ago

That's what is making my suspicious. Do a case sensitive search on your solution and your build folder to make sure you don't have that somewhere.

Jaeiya commented 8 years ago

Okay, I've fixed the case issue. I was setting the route to About instead of about, but it's still not using the app-build file.

Jaeiya commented 8 years ago

I think I've found the issue. I have .pug files that I serve from the server so it will always need to request those. I set the view strategy using getViewStrategy() on the view model to request the files without an extension. Using this method, Aurelia won't load the app from the app-build. If I remove the strategy, it will load the app just fine, except that it's requesting the wrong view (app.html).

Is this a bug with Aurelia?

Edit The only way to fix this currently is to tell my server that a request for an .html file is actually a request for a .pug file, which is easy to do, but not ideal. Maybe you have an idea on how to adjust the view strategy so that it will request without any extension and still serve the view model from the app-build file?

Edit to Add Pug files are the new Jade template files. Company changed name.

Last Update Nope, turns out I was mistaking the app request for the app.js request. View strategy works as intended and all files are using the bundle now :)