Skip to content
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

BundlerMinifier does not work after update Visual Studio #536

Open
wimbaens opened this issue Feb 16, 2021 · 20 comments
Open

BundlerMinifier does not work after update Visual Studio #536

wimbaens opened this issue Feb 16, 2021 · 20 comments

Comments

@wimbaens
Copy link

wimbaens commented Feb 16, 2021

Installed product versions

  • Visual Studio: 2019 16.8.5
  • This extension: 3.2.499

No minification happening since the latest Visual Studio Update.
Menu item is gone on right click solution. Also no bundleminifier options on right click bundlefile.

2021-02-16 09_52_46-Window

@jweschenfelder
Copy link

jweschenfelder commented Feb 26, 2021

Hello, we experience exaclty the same issue:

  • Visual Studio Enterprise 2019: 2019 16.8.6
  • This extension: 3.2.499

Edit/Remarks: We only bundle and minify SCSS -> CSS -> MIN.CSS. That means that we only use style scripts and no JS at all because we use Blazor which is an SPA framework. My computer got installed two weeks ago, it was still working there about 1 week ago, and I can confirm it stopped working after installing a bigger Visual Studio update. That’s the last thing that happened before the BundleMinifier stopped working. My colleague has the older Visual Studio Enterprise 2019 Version 16.8.3 installed and BundleMinifier is still working there. My output window in Visual Studio tells during the Build that BundleMinifier allegedly bundles and minifies the CSS successfully, but no output file was created then, the output files remain untouched. I can also confirm that the menu item is gone in context menu like described from wimbaens.

@silentdiverchris
Copy link

silentdiverchris commented Feb 27, 2021

Hi I'd like to report the same behaviour here, also with BundlerMinifier.Core 3.2.499 on Visual Studio 2019 16.8.6

Not sure when it broke but I recently had to completely reinstall Windows and re-get my entire source from git, so I kinda expect that's when it started not working - I only notice the problem now a month later as I had to change some javascript, first js change since the Windows rebuild.

Fairly complex bundleconfig.json, it used to happily generate four different 'whatever-bundled.min.js' from various combinations of several 'whatever.js' files when I built but no longer doing this.

No context menu appears on the bundleconfig.json file, I tried deleting one of the old generated whatever-bundled.min.js files and nothing I do regenerates it, including full release/publish to Azure.

I've tried altering the bundleconfig.json slightly to give it a prod, rebuilt in dev, rebuild in release configuration, restart VS, reinstall bundlerminifier, cursing, sacrificing small animals, and repeat same steps again, same behaviour.

I read a solution about the javascript being broken, but it runs fine, the files that make up the bundle are run from the original js in development so that shouldn't be causing a problem with the bundling (and wouldn't stop the context menu item appearing either I guess).

Cheers, Chris

@silentdiverchris
Copy link

silentdiverchris commented Mar 4, 2021

Hi, absolutely no pressure, I appreciate the work that's gone into this fantastic free product and the support and all that.... but... is this being looked at soon ? If not then no problem, I'll switch to another addon or do some other workaround but I'd prefer to avoid rejigging a bunch of my projects so I can release new versions with javascript changes, then find you fixed this the next day :)
I've retried a bunch of things but just can't get t rebuilding my bundled-xxxxx.min.js files.


6 days later - hi again, apologies for pressing the issue but I still can't build any javascript bundles... I come back to this every day or two to see if there is a fix, then retry reinstalling the package, recreating the bundlerconfig, then restarting VS, clean project, rebuild etc., done that a couple of times now and have just done it again but nothing brings back the context menu on bundleconfig.json, so I can't build my bundles.

I need to find a resolution of some kind soon, I can hold back on new additions but am concerned that if I needed to fix some serious bug in the javascript I'd not be able to rebundle - just an indication that it's being looked at would be much appreciated, thanks.

@jweschenfelder
Copy link

Same for us. If there is no update soon, we consider to switch to another bundler & minifier. For now we are doing it via manual process with https://www.cssportal.com/scss-to-css/ and https://cssminifier.com/ which cannot be the solution.

@jtsom
Copy link

jtsom commented Mar 10, 2021

This has been an issue for over 2 years now - #391 and it's affecting our Azure DevOps build pipeline. We do not have the extension loaded, just the NuGet packages. Our only option is to not minify our javascript files.

@silentdiverchris
Copy link

silentdiverchris commented Mar 11, 2021

Our only option is to not minify our javascript files.

That will be my emergency solution if I have to make a new release with changed javascript, not entirely optimal.
Damn, if it's a long-time issue I guess I'll have to start looking around at alternatives, ta for the info.

@jweschenfelder
Copy link

I had already worked with Laravel Mix in my former company to bundle and minify JS and SCSS/CSS. The problem is that you need the Node.js then which is not small (Node.js is practically already included in a VS 2019, but needs to be explicitly selected when installing VS 2019). Laravel Mix is similar to Gulp. BundlerMinifier is far easier to handle than Laravel or Gulp and the configuration files for BundlerMinifier look less complex, too. I would really prefer if someone would fix this issue.

@silentdiverchris
Copy link

silentdiverchris commented Mar 11, 2021

I've used this and WebCompiler by the same Mads chap for some time and they've been fantastic, really solid and simple to implement even the most non-trivial setups. I tend to have different bundles of css and js for different types of user, no need for a guest to get all the javascript for the admin/back office areas that they'll never execute, and good reasons for them not to have them at all; Mads' stuff always handles building these multiple custom bundles a treat.

It'd be a big shame to switch look to something more complex or not as smooth and functional, and with the symptom being so glaring - no context menu appearing on bundlerconfig.json - it shouldn't be too onerous to nail down what the problem is or at least chuck some diagnostics in to point in the right direction.

I guess one answer would be to get the code and have a look myself rather than waiting for a free fix to this free software I am so keen to use, guilty as charged !

@jweschenfelder
Copy link

jweschenfelder commented Mar 15, 2021

Meanwhile I would guess that it might have to do with Microsoft's switch to .NET Core and .NET Standard why this NuGet package is not updated yet. Ironically, the following package for .NET Core with Dependency Injection seems to be more up-to-date: https://github.com/ligershark/WebOptimizer.Sass (updated a few days ago).

EDIT: We have helped ourselves with this solution now (for SCSS to CSS only!)...
1.) At first, try LigerShark.WebOptimizer (which seems to replace BundlerMinifier in the near future). Please note that there only exists a Beta Version of this package yet: https://www.nuget.org/packages/LigerShark.WebOptimizer.Sass
2.) For us, LigerShark.WebOptimizer unfortunately didn't work yet, so I had implemented a solution by myself now:
Please note that LigerShark.WebOptimizer.Sass is using https://www.nuget.org/packages/SharpScss as a dependency. That's great because SharpScss is from another author and it works fine. I have simply implemented a class now which uses SharpScss which is doing the following call:
var someScssFile = await File.ReadAllTextAsync("someScssFile.scss");
var result = Scss.ConvertToCss(someScssFile, new ScssOptions() //Using SharpScss
{
//Additional SharpScss Options
InputFile = "someScssFile.scss", //this information is for debugging only, it does not import any file
OutputFile = "someCssFile.min.css", //this information is for debugging only, it does not generate any file
OutputStyle = ScssOutputStyle.Compressed,
GenerateSourceMap = false
});
await File.WriteAllTextAsync("someCssFile.min.css", result.Css);
Now we can inject this class with dependency injection in C# .NET Core during Startup and also execute it via a UnitTest class directly. Instead of using a single import file 'someScssFile', you can also also combine/concat all SCSS with StringBuilder before you convert it with SharpScss to CSS.
(Another alternative option would be Gulp, Grunt or Laravel Mix, but they are dependent on npm (Node.js).)

@silentdiverchris
Copy link

silentdiverchris commented Mar 18, 2021

I just needed to change the text of a javascript generated field validation message on a dialogue.... so edited the source javascript and also edited the generated bundled-xxxxx.min.js file... so I got by this time but anything much more involved and I'll need to find another bundler, damn.

Please can we have an indication of whether this problem is going to be looked at or not, no drama if not, that's absolutely fine, you provide this very useful addon for free and it's much appreciated; but the silence is making it hard to decide what the best way forward is for myself and others who have built systems around this great bundler.

Having completely uninstalled and reinstalled the addon twice myself, and still being unable to bundle anything; short of completely reinstalling Visual Studio, as far as I can see from here this issue isn't an edge case, it's a full-on "A fresh install simply doesn't work" one.

@silentdiverchris
Copy link

silentdiverchris commented Apr 3, 2021

I found a partial-but-good-enough solution.

I was missing / needed to install the BuildBundlerMinifier package in addition to BundlerMinifier.Core.

I can't find any documentation that says you need both, or a mention of the 'base' one in the .Core one's description; maybe that should be obvious to me, but it wasn't.

Not a complete fix, the context menu still doesn't appear on the bundleconfig.json file but the bundles in it are regenerated at build time, which is good enough for me. Maybe the Core version isn't supposed to have a context menu, either way, I can rebundle my .js files now, hooray.

As far as I'm concerned, this issue can be closed.

@jweschenfelder
Copy link

Please keep the issue open because I could not get it running. And we had BuildBundlerMinifier installed as a NuGet package. Unless it is solved for wimbaens now, too. Then it might be a local installation problem. Since I have left the company and the project, the issue has solved for me in another way.

@silentdiverchris
Copy link

Please keep the issue open because I could not get it running. And we had BuildBundlerMinifier installed as a NuGet package.
Unless it is solved for wimbaens now, too.

Yep, not my decision to close it, just saying it's resolved for me as far as it needs to be; I hope it's the solution for wimbaens too.

@jweschenfelder
Copy link

Update: I see right now, that a PR was made for .NET 5.0 Support today. We were already using .NET 5.0. Maybe that was the reason: #550 (review)

@jtsom
Copy link

jtsom commented Apr 5, 2021

Unfortunately, looking at the code associated with the PR, it has nothing to do with fixing the issue - just adds .NET 5 support.

@wimbaens
Copy link
Author

wimbaens commented Apr 6, 2021

The installation of the BuildBundlerMinifier package did fix the minification on build.
But the menu is still missing, I keep the issue open unless someone finds a solution for the second part.

@silentdiverchris
Copy link

silentdiverchris commented Jul 2, 2021

It's stopped working for me again on build, I'd lost the context menu way back but was still OK as it was re-bundling on build until I'm not sure when. I tried reinstalling the Core and Build... packages but it's still not working.

The javascript is all being processed fine as per bundleconfig.json but compilerconfig.json isn't being acted upon to produce css files.

I'm about to handcraft a layout fix into the .css so I can make a release, then investigate this further but this is becoming a liability, the project it's used in is essentially complete so I only discover it's stopped working again when I need to make a layout fix.

There are a few new issues raised in the last month but I'm not sure anyone is supporting this any more, I ought to look at alternatives, shame, I really like BundlerMinifier.

Usual caveats about not wanting to gripe too much about open source code that's been fantastic until 6 months ago and that I've not put any work into other than raising issues, but it'd be good to know if it's going to be developed any more or if grateful users need to reluctantly say thanks for all the bundling and look for alternatives.

@silentdiverchris
Copy link

silentdiverchris commented Jul 7, 2021

I got it working again ! - am sorry to say I don't have a '5 steps to make the world right again' procedure, I removed and reinstalled the three packages a few times over the last couple of days with lots of restarts and refreshes, deleted (well, moved) and reinstated bundleconfig.json and compilerconfig.json and swore at it, not sure which of these did the trick, I do remember that the last time I installed BuildBundlerMinifier first, then BundlerMinifier.Core, then BuildWebCompiler last, no idea if that is relevant.

My setup now works as before, right now at least; i.e. I don't get a context menu item off the main .scss files but it is properly processing the long list of scss imports in my 4 top level scss files and minifying on build, which is more than good enough for me.

My package references are as below, using Visual Studio 16.10.3;
image

I now get the scss files being processed on build;
image

Funnily enough today I had decided to bite the bullet and install the VS2019 extensions feature to try rebuilding the extensions locally to see if I could at least add some scratch tracing to see what the problem was. I didn't have that installed last time it worked but it is installed now. That probably makes no difference but you never know. There is always the possibility that the code sensed with a deep, cold dread that I was about to get my gnarled fingers around its neck and decided to capitulate !

@Jackson-Calixto
Copy link

Jackson-Calixto commented May 3, 2022

I'm not sure if the problem was that or not, in my case, I already had added the budleconfig.json before adding the Bundler & Minifer extension.
Then installed the extension and closed, reopened many times, Then installed BuildBundlerMinifier first, then BundlerMinifier.Core and restarted the VS again and nothing happened.
Finally I deleted the budleconfig.json and added again then suddenly the X show up and now the context menu is there...

@TehWardy
Copy link

From what we could tell the problem is something like ...
Clean the solution -> generated files get removed
Build locally -> they get added again
Commit -> files missing on release

Clean the solution -> generated files get removed
Commit -> files available on released deployed app

Not sure why ... maybe some weirdness / difference between local and build environment.
I presume that's what others are seeing though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants