MaximBalaganskiy / AureliaDotnetTemplate

Aurelia .Net Template
43 stars 14 forks source link

Getting an error on Boot.ts #8

Closed si2030 closed 5 years ago

si2030 commented 5 years ago

On the off chance you are watching this I am getting the following error in the console:

TypeError: Cannot read property 'href' of undefined at boot.ts:35 at HttpClient.push../node_modules/aurelia-fetch-client/dist/native-modules/aurelia-fetch-client.js.HttpClient.configure (aurelia-fetch-client.js:160) at Module.configure (boot.ts:34) at aurelia-bootstrapper.js:128

in which is failing on this line in boot.ts

new HttpClient().configure(config => { const baseUrl = document.getElementsByTagName("base")[0].href; config.withBaseUrl(baseUrl); });

This was commented out in the template but worked in the old version for me.. any chance you might know the reason for the error? Regards Simon

MaximBalaganskiy commented 5 years ago

There's no base element in the new template, that commented code should be deleted

On Sun, May 26, 2019, 11:19 AM si2030 notifications@github.com wrote:

On the off chance you are watching this I am getting the following error in the console:

TypeError: Cannot read property 'href' of undefined at boot.ts:35 at HttpClient.push../node_modules/aurelia-fetch-client/dist/native-modules/aurelia-fetch-client.js.HttpClient.configure (aurelia-fetch-client.js:160) at Module.configure (boot.ts:34) at aurelia-bootstrapper.js:128

in which is failing on this line in boot.ts

new HttpClient().configure(config => { const baseUrl = document.getElementsByTagName("base")[0].href; config.withBaseUrl(baseUrl); });

This was commented out in the template but worked in the old version for me.. any chance you might know the reason for the error? Regards Simon

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MaximBalaganskiy/AureliaDotnetTemplate/issues/8?email_source=notifications&email_token=AA4KNPCG2ABJF3QBP3PT4RTPXHQTJA5CNFSM4HPVVUV2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GV32WMA, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4KNPH66SNTNAGTKHJ6O53PXHQTJANCNFSM4HPVVUVQ .

si2030 commented 5 years ago

Its come up.. teething problems.. Thanks for responding again..

I had it uncommented on my original.. and I did comment it out.. is it that I dont actually need it now..

MaximBalaganskiy commented 5 years ago

There was an issue with publicPath in previous webpack config which that code solved. Absolute path didn't work well with virtual directories. I now changed the path to relative and this fix to copy ~ to http client is not needed.

si2030 commented 5 years ago

Thanks Maxx