AssertionError in WebGL build on Unity 2021.2.8

After I tried to upgrade the project from Unity 2019.4.31 to 2021.2.8, WebGL fails on build.

At first I used the old WebGL template i had, then i tested with the default Unity template but the errors stay the same.I tried normal & clean build.Restarted Unity and search about it for a while but I didn’t come up with any results. The error is the following and occurs with 4-5 files.
need for speed mod apk 5.8.1
Building C:…\webgl-test\TemplateData\style.css failed with output: assert.js:385 throw err; ^

AssertionError [ERR_ASSERTION]: Invalid preprocessor argument: TOTAL_MEMORY=-2147483648 at Object. (C:\Program Files\Unity\Hub\Editor\2021.2.8f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Preprocess.js:18:12) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) at Function.Module._load (internal/modules/cjs/loader.js:879:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { generatedMessage: false, code: ‘ERR_ASSERTION’, actual: false, expected: true, operator: ‘==’ }

It seems like there’s an issue with the preprocessor argument “TOTAL_MEMORY=-2147483648” when building for WebGL in Unity 2021.2.8. This might be causing the assertion error. You could try adjusting or removing this argument in the build settings to resolve the problem. Additionally, ensuring compatibility with the updated version’s settings and configurations might help resolve these errors. click here for more details