-
Notifications
You must be signed in to change notification settings - Fork 55
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
Uncaught SyntaxError: import.meta may only appear in a module #281
Comments
In this issue, they seem to have fixed their issue by updating NuGet packages. Checking the project in your archive, it seems indeed that Microsoft.AspNetCore.Components.WebAssembly v6.0.0 is still being referenced instead of v7.0.0. I got the project running by explicitly upgrading it in Client.fsproj: <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" /> It's quite annoying to have to do that explicitly though. I think it'll be better if I add the above line in the project template when I upgrade it to net7.0 (I'd rather not raise the requirement in the Bolero package itself). |
Thank you. That finally solves it. Strange I didn't connect things, though I've been thinking about checking the assembly versions next. I thought the system - dotnet that is - was better than this, in this area. I know there are shortcomings, but I can see now that most of AspNetCore assemblies are not version 7.0.0! I need a lot of explicit references for that. But System.* seems to be ok. I noticed yesterday that HtmlAgilityPack.dll is not the latest. Possibly also not FSharp.SystemTextJson.dll. Maybe I need to consider using Paket after all, even though I feel it's such an incredible hassle. |
There is one more thing to note. The sample produces this for the client project file:
If you just change
Then it works. |
That's odd, in my attempt on the TodoMVC project, I updated DevServer to 7.0.0 and it worked. |
@Bananas-Are-Yellow, I don't understand your point. If you "remove the But the |
Hmm... maybe I'm beginning to understand your point. I don't see a *.DevServer.dll when trying to get it back. Perhaps it's just a namespace in *.WebAssembly.dll ? Sorry, don't have time to figure this out now, but just thought I'd let you know how this ended here. |
It seems that a package reference to It also seems that So my conclusion is that both references should be present in the client project file. (Remember to do a |
|
Experimental update as Bolero does not officially support .NET 7 yet Followed fsbolero/Bolero#281 (comment) Removed modified .NET startup JS as it was probably updated in .NET 7 and would lead to errors
There is now an explicit reference to Microsoft.AspNetCore.Components.WebAssembly 7.0.* in v0.21 of the project template. |
If I remove the explicit reference
from the client project file, then the problem |
Actually, I realize that I could make the dependency on Components.WebAssembly change based on the framework in the Bolero package itself. That would make things simpler than having to keep the right version in the project file. |
Bolero 0.21.25 should now be working without an explicit dependency on Microsoft.AspNetCore.Components.WebAssembly. |
Works now. |
When a server-client project created from the Bolero template (latest) is updated from net6.0 to net7.0, the following error appears in browsers. The Bolero page is also blank, except for the dark Bulma bar with logo at the top which is served by the server-side early, I believe before WebAssembly kicks in.
Firefox:
Uncaught SyntaxError: import.meta may only appear in a module
source: dotnet.7.0.0.amub20uvka.js
Chrome and Edge:
Uncaught SyntaxError: Cannot use 'import.meta' outside a module
source: some other js-file with a cryptic name
It's actually the same error, just with slightly different wording, and Firefox is also kind enough to hint about the platform version, which is important here.
How to reproduce:
Run the following web application generated with the latest Bolero template in Visual Studio 17.4.0, currently latest. Also fails in latest Preview version.
HelloWorld.zip
Note that the page is blank, except for the dark Bulma bar with logo at the top.
In a Firefox browser, inspect the page errors using the browser's developer tools. Note that the name of the failing file indicates this is dotnet7.0.0
To verify that it works with net6.0, change the target in the client to net6.0. That's all that is needed for success, though the Microsoft assembly can also be downgraded for good measure. Now run with Firefox again, and note that now there is a javascript file name containing dotnet6.0.11, or whichever version of 6.0.x is on the machine.
Observed on two out of two developer machines so far.
This is a continuation of the problem solving in #279, related to updating to .NET 7. This is a second issue. The first issue was resolved through the use of
ProduceReferenceAssembly
with valuefalse
in client project files.Additional information. These two log files are the outputs from the console when running net6 and net7. I am not much of an expert here, but I'm guessing there's not much to gain from studying these, except that net7 doesn't deliver the missing content.
lognet7b.txt
lognet6b.txt
Of course you can test with browsers other than Firefox, but you'll miss the nice version indication in the WebAssembly javascript filename.
The text was updated successfully, but these errors were encountered: