Comments (11)
The problem is resolved with v2.0.7.
Thanks!
from localstorage.
I've now pushed a new version of the package which no longer needs a JavaScript file. This should completely remove the issue. Please give it a go and let me know if you have any issues.
from localstorage.
I can confirm that upgrading to Blazor Preview7 requires manual add on script tag to function properly.
from localstorage.
@netclectic - Is this still the case with v2.0.7?
@dinonovak - Which version are you using and is that client-side Blazor or server-side?
from localstorage.
Great stuff. Iām going to go ahead and close the issue as things seem to be working as expected now.
from localstorage.
I'm still receiving this issue in the browser and updated the _Host file to:
<script src="_content/Blazored.LocalStorage/blazored-localstorage.js"></script>
Running the the latest LocalStorage - 2.0.11
Running core preview8 in docker image - core/sdk:3.0.100-preview8-disco
I get a 404 for the js file in the browser.
Thanks!
from localstorage.
@joshhubers Have you tried a clean/re-build/clear of browser cache. I've had a lot of people have this issue and one of those sorts it out.
There are some issues with the new Razor Class Library right now. So it might be best to just manually copy the JS file from this repo into your solution.
from localstorage.
I have a blazorwasm app but served by a webapi. In order to get Blazored.LocalStorage working I had to add this to Blazored.LocalStorage.csproj.
<ItemGroup>
<!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
<EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="wwwroot\**\*.css" LogicalName="blazor:css:%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="wwwroot\**" Exclude="**\*.js;**\*.css" LogicalName="blazor:file:%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
This will copy all embedded resources to bin/Debug/netstandard2.0/dist/_content/Blazored.LocalStorage/* so Kestrel can serve.
Doing this the tag <script src="_content/Blazored.LocalStorage/blazored-localstorage.js"></script>
is added automatically by Blazor in index.html.
This not affect BlazorClientSide sample app.
I create a pull request #29.
from localstorage.
@thild This code is now legacy and not the way class libraries need to work going forward. As of right now the situation is this. Both JS and CSS in Razor Class libraries gets included in host projects correctly at development time. If you're not seeing this then see my comment above explaining the steps to go through to get things working.
However, both for client-side Blazor and server-side Blazor there is an issue with publishing which stop static assets being included correctly, this is going to be fixed in Preview 9 (I hope!).
from localstorage.
@chrissainty Thanks for clarification. Investigating further I found that is a known Blazor issue dotnet/aspnetcore#13122. The workaround mentioned there is run the project in development environment.
ASPNETCORE_ENVIRONMENT=Development dotnet run
or setup Properties/launchSettings.json
{
"profiles": {
"ServerProjectName": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/"
}
}
}
However, you might consider keeping the EmbeddedResource workaround in .cpsproj
until the Blazor team resolves this issue, as this does not affect the new way of referencing static assets.
from localstorage.
I tried the new version. Removed reference to js and everything is working. Nice solution. Thanks.
from localstorage.
Related Issues (20)
- How to send facebook token(passport-facebook) from Frontend after I logged in?
- how inject in Code behind in program.cs HOT 5
- AddBlazoredLocalStorage() add public setter for options.JsonSerializerOptions HOT 2
- [Bug] LocalStorage crashes without throwing exception HOT 14
- [Bug] Impossible to make it work HOT 1
- [Bug] ASP.NET Core AggregateException on startup after injecting BlazorLocalStorage with dependency injection HOT 2
- [Bug] Performance Impact on Multiple SetItem Calls
- [Security] Consider updating Microsoft.AspNetCore.Components.Web dependency
- Net 8.0 iOS System.Text.Json.Serialization.JsonConverter System.ArgumentOutOfRangeException [Bug] HOT 1
- Unhandled exception rendering component: Please use dedicated worker for working with JavaScript interop. See https://aka.ms/dotnet-JS-interop-threads
- .Net 8 RenderMode.InteractiveServer CustomAuthenticationStateProvider[Bug] HOT 2
- Error in .NET 8 : Method not found HOT 3
- [Feature Request] Common Interface between ILocalStorageService and ISessionStorageService
- is it not working on net maui Hybrid? HOT 1
- [Bug] Lists of tuples are not being serialized correctly
- blazored.localstorage is missing NuGet package README file
- [Bug] Can't use local storage in a SSR HOT 1
- [Question] How can I use it in program.cs ? HOT 3
- Whether cookie operations can be added
- [Feature Request] An option to automatically add `location.pathname` to keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localstorage.