abp icon indicating copy to clipboard operation
abp copied to clipboard

Incorrect Bundle Configuration in Default Project Template

Open JoelAuren opened this issue 8 months ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description

When creating a new project using the latest ABP Framework project template with the LeptonX Lite theme, there is a misconfiguration in the ConfigureBundles method. Specifically, the global-scripts.js file is being added to the StyleBundles instead of the ScriptBundles, which causes the JavaScript file to be treated as a style and not executed properly.

Current Code in Template:

private void ConfigureBundles()
{
    Configure<AbpBundlingOptions>(options =>
    {
        options.StyleBundles.Configure(
            LeptonXLiteThemeBundles.Styles.Global,
            bundle =>
            {
                bundle.AddFiles("/global-scripts.js");
                bundle.AddFiles("/global-styles.css");
            }
        );
    });
}

Problem:

The above code incorrectly includes /global-scripts.js in a StyleBundle, which results in the JS file being handled as a CSS file. This breaks expected behavior and can lead to runtime issues.

Suggested Fix:

Update the method to separate script and style bundles correctly:

private void ConfigureBundles()
{
    Configure<AbpBundlingOptions>(options =>
    {
        options.StyleBundles.Configure(
            LeptonXLiteThemeBundles.Styles.Global,
            bundle =>
            {
                bundle.AddFiles("/global-styles.css");
            }
        );

        options.ScriptBundles.Configure(
            LeptonXLiteThemeBundles.Scripts.Global,
            bundle =>
            {
                bundle.AddFiles("/global-scripts.js");
            }
        );
    });
}

I am using ABP Cli 0.9.25 with command: abp new Test -m none --theme leptonx-lite -csf --no-tests

Reproduction Steps

No response

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

9.1.0

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

JoelAuren avatar Apr 30 '25 10:04 JoelAuren

I remember it's already fixed in the latest 0.9.26

Thanks.

maliming avatar May 01 '25 05:05 maliming

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 18 '25 23:07 stale[bot]