Open leodjacob opened 2 years ago
I had the same issue, can you check if the note I added in this PR helps?
https://github.com/ligershark/WebOptimizer/pull/235/commits/e0b51f017f6ece1125c3c089fd7e118934ceb013
All the files for WebOptimizer were explicitly added to the pipeline. Each file had filename that included the build number, so there was cache busting, just from that. I used WebOptimizer for the bundling feature.
When I got the error, I was careful to clear the cache manually, and reload the page. And I could see that the latest version of the file had been sent down to the browser.
The error seemed to fail early on, where I had a line like this in my javascript:
let myVar = "something";
I could get past the error by changing it to:
const myVar = "something";
(But that was not a solution, of course. It's bad to declare something as a const when it's not really a const.)
May be there's an error with character sets - the file arrives at the browser in a character set that the Javascript engine cannot interpret. (The browser can display, etc. without problems.) Why does everything work fine in DotNet Core 5 and not in DotNet Core 6? May be there was a conversion of C#'s internal character set to utf-8 downstream from WebOptimizer in DotNet Core 5, and this was taken out of DotNet Core 6.
I had to deploy my project, and ended up removing WebOptimizer. I'm minifying manually and creating a single bundled file for all my javascript and css manually, from sites that make minifiers available. The filename of the bundle file takes the build number into account, so there'll be cache busting from that. Takes more work but it is just for deployment. It might be better: the page will load with fewer requests/responses?
PS: The "Uglifier" minifier has errors - apparently not compatible with ECMA6 or something. "Terser" works great.
On 06/05/2022 4:08 AM salembream ***@***.***> wrote: I had the same issue, can you check if the note I added in this PR helps? e0b51f0 https://github.com/ligershark/WebOptimizer/commit/e0b51f017f6ece1125c3c089fd7e118934ceb013 — Reply to this email directly, view it on GitHub https://github.com/ligershark/WebOptimizer/issues/239#issuecomment-1146784876 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPBIEJ2DEHTMFIQREO5MJTVNSDDNANCNFSM5XIWE2QA . You are receiving this because you authored the thread.Message ID: ***@***.***>
Any alternative for .NET 6?
We had the same problem as everyone - WebOptimizer just does not work with .net 7 projects. So we wrote our own using gulp and a tag helper. Feel free to use it although it does require some initial setup:
I just upgraded my project to Dot Net 6 and WebOptimizer has stopped working. Everything was working fine in Dot Net 5.
The project compiles without errors. However, there's an issue when running the project (in debug mode). The browser cannot make sense of the Javascript file when WebOptimizer is told to bundle (& minify), or just minify. No errors when WebOptimizer is not invoked.
This seems to be separate from WebOptimizer handling CSS files.
I'm using Visual Studio 2022 for Mac and the browser is Safari. Error encountered when running the project in debug mode.