I upgraded from 2021.1.21f1 to 2021.1.22f1 and after doing so I am no longer able to build for WebGL. I downgraded back to 2021.1.21f1 and it worked fine.
Here is the error I get on 2021.1.22f:
ArgumentException: The Assembly UnityEngine is referenced by Newtonsoft.Json ('Assets/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[ ] allAssemblyPaths, System.String[ ] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[ ] allAssemblyPaths, System.String[ ] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[ ] paths, System.String[ ] foldersToSearch, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Usually if you upgraded unity version to a version with very very minor updates (the diff between versions is xxxx.x.x1 to xxxx.x.x2) that means it’s a Unity problem and you’ll just have to upgrade to another version, has happened to me many times with WebGL, I kept down and upgrading versions till I found the perfect version