question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ASP.Net Core Generator adds wwwroot to script urls

See original GitHub issue

The ASP.Net Core Generator is properly placing the transpiled and bundled scripts in wwwroot\scripts. Unfortunately, wwwroot is being written to the paths placed in requirejs.config in vendor-bundle.js. This means that requirejs tries to load wwwroot/scripts/app-bundle.js instead of scripts/app-bundle.js. This keeps the Aurelia app from properly loading.

When I hand edit vendor-bundle.js to change the location for app-bundle.js from

"app-bundle": "../wwwroot\\scripts/app-bundle"

to

"app-bundle": "../scripts/app-bundle"

the aurelia app runs successfully.

Also, all of the instances of \\ can simply be replaced with / in aurelia.json.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
dkobierskicommented, Dec 23, 2016

In version 0.23.0 I just needed to change build>targets>output in aurelia_project/aurelia.json to “wwwroot/scripts” from “scripts”. So it seems the issue still persists.

3reactions
searuscommented, Jun 23, 2016

@EisenbergEffect, I have a workaround for this which means you don’t have to manually edit the vendor-bundle.js every time. Maybe the solution could be incorporated, but I don’t feel confident enough with this repository yet to make a pull request.

In the aurelia_project/aurelia.json file, add the following additional property:

 "build": {
    "targets": [
      {
        "id": "aspnetcore",
        "displayName": "ASP.NET Core",
        "output": "wwwroot/scripts",
        "baseUrl": "scripts" // new property to handle module path generation correctly
      }
    ],

Then, make a small edit in node_modules/aurelia-cli/lib/build/bundle.js as follows:

In the createRequireJSConfig method, replace the following line:

config.paths[currentBundle.moduleId] = '../' + platform.output + '/' + currentBundle.moduleId;

with this line:

config.paths[currentBundle.moduleId] = '../' + platform.baseUrl + '/' + currentBundle.moduleId;

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding script references in ASP.NET CORE control - Syncfusion
This section provides information about reference scripts from CDN and Custom resource generator (CRG) for Syncfusion ASP.NET Core controls.
Read more >
Configure ASP.NET Core to work with proxy servers and load ...
Learn about configuration for apps hosted behind proxy servers and load balancers, which often obscure important request information.
Read more >
Dealing with Application Base URLs and Razor link ...
I want to have multiple microsites (the main page, the podcast, the blog, etc) with regular backups, CI/CD pipeline (check in code, go...
Read more >
Map to wwwroot in ASP.Net 4? - Stack Overflow
Create HttpHandler for handling request to specific file extensions. And modify the file real path using provided file relative path from the URL....
Read more >
Routing in Razor Pages
Areas were introduced to Razor Pages in ASP.NET Core 2.1. Routes to resources in areas have the name of the area as the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found