Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cropperJsInterop.min.js not found when publishing server-side Blazor app in subfolder #394

Open
cryo75 opened this issue Dec 13, 2024 · 1 comment
Assignees

Comments

@cryo75
Copy link

cryo75 commented Dec 13, 2024

I am publishing my server-side Blazor app in a subfolder so I first did the following:

builder.Services.AddCropper(new CropperJsInteropOptions()
{
    DefaultInternalPathToCropperModule = "subfolder/_content/Cropper.Blazor/cropperJsInterop.min.js"
})

The app runs as expected. However, when I set the image to be cropped, nothing is displayed. So then I change the above to:

builder.Services.AddCropper(new CropperJsInteropOptions()
{
    IsActiveGlobalPath = true,
    GlobalPathToCropperModule = "subfolder/_content/Cropper.Blazor/cropperJsInterop.min.js"
})

And when I set the image I get the following exception:

13T09:14:56.952Z] Error: Microsoft.JSInterop.JSException: Failed to resolve module specifier 'subfolder/_content/Cropper.Blazor/cropperJsInterop.min.js'
TypeError: Failed to resolve module specifier 'subfolder/_content/Cropper.Blazor/cropperJsInterop.min.js'
at https://mywebsite/subfolder/_framework/blazor.server.js:1:947
at https://mywebsite/subfolder/_framework/blazor.server.js:1:3047
at new Promise ()
at y.beginInvokeJSFromDotNet (https://mywebsite/subfolder/_framework/blazor.server.js:1:3004)
at Xt._invokeClientMethod (https://mywebsite/subfolder/_framework/blazor.server.js:1:60890)
at Xt._processIncomingData (https://mywebsite/subfolder/_framework/blazor.server.js:1:58279)
at Xt.connection.onreceive (https://mywebsite/subfolder/_framework/blazor.server.js:1:51920)
at s.onmessage (https://mywebsite/subfolder/_framework/blazor.server.js:1:80026)
at Cropper.Blazor.Services.CropperJsInterop.LoadModuleAsync(CancellationToken cancellationToken)
at Cropper.Blazor.Components.CropperComponent.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

How can I set the correct path to get the cropper to work again?

@MaxymGorn
Copy link
Member

Hi @cryo75. Just try to find your files in published folder or via dev tools

@MaxymGorn MaxymGorn self-assigned this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants