Code Monkey home page Code Monkey logo

Comments (12)

sven-n avatar sven-n commented on June 4, 2024 3

For anyone else with this issue, calling dotnet run will not set the ASPNETCORE_ENVIRONMENT variable. If it isn't set, it defaults to Production. Static web assets are enabled by default in the Development environment, so running dotnet run --environment "Development" fixed the issue.

To make it work for all environments, call UseStaticWebAssets() on the IWebHostBuilder when you set up your IHost, e.g. in your Program.cs.

Example:

        public static void Main(string[] args)
        {
            var host = Host.CreateDefaultBuilder(args)
                .ConfigureServices(serviceCollection =>
                {
                    // ...
                })
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                    webBuilder.UseStaticWebAssets(); // <---
                })
                .Build();
            host.Run();
        }

from typeahead.

chrissainty avatar chrissainty commented on June 4, 2024

Have you tired doing a full clean and rebuild? Do you have the .NET Core 3 SDK installed? I use this project most days at the moment for testing new features so it definitely works.

from typeahead.

 avatar commented on June 4, 2024

Clean and rebuild without success, though if I start debugging inside VSCode then everything seems to work. If I call dotnet run from the command line then blazored-typeahead.css and blazored-typeahead.js are not found resulting in the error.

dotnet --list-sdks
3.0.100 [/usr/local/share/dotnet/sdk]

from typeahead.

chrissainty avatar chrissainty commented on June 4, 2024

I'm not sure what to suggest. I've tried the sample on my personal laptop, my work laptop and my wife's MacBook and it runs fine on all of them. I think this may be a local issue on your machine I'm afraid.

Just to be sure we're doing the same thing. I got the latest from master moved into the samples\BlazorServerSide\ directory and ran dotnet run. I then opened the app in a browser - everything runs fine.

from typeahead.

 avatar commented on June 4, 2024

Odd, shall close this then. Thanks for looking into the issue anyway! :)

from typeahead.

chrissainty avatar chrissainty commented on June 4, 2024

I'm really sorry I couldn't help with this one. It's very strange.

The only other thing I can think of is deleting and recloning the repo. Also have you tried doing a clean and rebuild and then opening the site in a incognito window? Sounds odd but might show if there is any weird cacheing issue.

from typeahead.

 avatar commented on June 4, 2024

For anyone else with this issue, calling dotnet run will not set the ASPNETCORE_ENVIRONMENT variable. If it isn't set, it defaults to Production. Static web assets are enabled by default in the Development environment, so running dotnet run --environment "Development" fixed the issue.

from typeahead.

SteveHindmarsh avatar SteveHindmarsh commented on June 4, 2024

Hi, I'm also getting Error: Microsoft.JSInterop.JSException: Could not find 'blazoredTypeahead' in 'window'. when using Blazor Server Side in IE11 with blazor.polyfill.min.js. Your example code does not show that you are using IE11 polyfills. Can you please test with polyfills and show your configuration if successful. Or let me know if it's broken so I can move on. Great code you've got in every other browser!

from typeahead.

chrissainty avatar chrissainty commented on June 4, 2024

@SteveHindmarsh IE11 isn't a supported browser I'm afraid, but the typeahead does only use very simple JS functions so things should work.

The error you're seeing is because the JS file isn't being included or run. Does the app work ok in a modern browser?

from typeahead.

SteveHindmarsh avatar SteveHindmarsh commented on June 4, 2024

Yes it works ok in modern supported browsers. However IE11 is unofficially supported for Blazor Server Side via the use of polyfills and many people like myself, in a corporate environment where IE is essential until we kill all the websites that require it, are making use of these polyfills so we can keep our skills modern whilst dealing with these behemoths. The choice is yours to support us. This seems to be the defacto standard for the polyfill at the moment https://github.com/Daddoon/Blazor.Polyfill/releases
Please let me know if this issue is to remain closed then I can decide to move on with another typeahead component or failing that endeavour to fix yours (this will be a mountain for me at this point)? Thanks

from typeahead.

chrissainty avatar chrissainty commented on June 4, 2024

Thanks for checking that out Steve. I'm more than happy to take a PR for IE11 support, but it's not something I have time to add support for. As you can appreciate, I do this in my spare time alongside a full-time job.

from typeahead.

Mansha786 avatar Mansha786 commented on June 4, 2024

I get the following exception when running the server side example project:
[2020-10-26T08:35:17.128Z] Error: Microsoft.JSInterop.JSException: Could not find 'BlazoredModal' in 'window'.
Error: Could not find 'BlazoredModal' in 'window'.

from typeahead.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.