happyfirst
happyfirst

Reputation: 1071

ScriptBundle not rendering scripts that are in a VirtualDirectory

I have a modular asp.net app where the modules are deployed inside virtual directories underneath the primary .net web application. We have a common module with a lot of stuff. I tried to move all of the common script files out of each client specific project into a common module.

If I create a script bundle that references files at the root level, it renders the script tag into the html. But it won't render script tags for bundles that point to files in a sub virtual directory.

For example:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/App_Modules/Common/Scripts/jquery-1.*"));

no longer renders any script tag and now I get jquery errors client side. I looked at the resultant html, and now there's no more script tag to download the jquery library.

Upvotes: 2

Views: 2723

Answers (2)

Koby Mizrahy
Koby Mizrahy

Reputation: 1371

I had the same problem. The root cause was that I included only minified scripts in the bundle. Once I placed in the scripts directory the uncompressed scripts, it rendered them correctly.

Upvotes: 3

Hao Kung
Hao Kung

Reputation: 28200

Unfortunately bundling doesn't yet support VirtualPathProviders so if your virtual paths are relying on a VPP to serve the resource, bundling won't be able to find them. This is a scenario we are investigating currently and hopefully will support soon.

Upvotes: 1

Related Questions