WebCompiler icon indicating copy to clipboard operation
WebCompiler copied to clipboard

"math" option in compilerconfig defaults not working

Open pmonty opened this issue 2 years ago • 12 comments

Installed product versions

  • Visual Studio: 2022 Enterprise
  • This extension: 1.14.10

Description

Getting the following error on compilation --math=always is deprecated and will be removed in the future.

with the following config in compilerconfig.json.defaults

    "less": {
      "autoPrefix": "",
      "cssComb": "none",
      "ieCompat": true,
      "strictUnits": false,
      "relativeUrls": true,
      "rootPath": "",
      "sourceMapRoot": "",
      "sourceMapBasePath": "",
      "sourceMap": false,
      "math": "always"
    },

Anyone know what the issue might be?

pmonty avatar Jan 12 '23 04:01 pmonty

I don't see it mentioned in their changelog, but I would ask the developers of less.js

https://github.com/less/less.js

failwyn avatar Jan 12 '23 13:01 failwyn

started a thread over there but no response yet. What version of less does this extension use?

pmonty avatar Jan 20 '23 00:01 pmonty

@pmonty

"less": "^4.1.3",
"less-plugin-autoprefix": "^2.0.0",
"less-plugin-csscomb": "^0.0.2"

failwyn avatar Jan 20 '23 11:01 failwyn

@failwyn just commented in my less.js issue and noticed it is a warning that is thrown. But this compiler extension is giving me

C:\Projects\LRM\LRM\assets\less\custom.less : WebCompiler error 0: --math=always is deprecated and will be removed in the future.

is it possible this extension treats warnings as errors? and is there a way to change this?

pmonty avatar Jan 24 '23 05:01 pmonty

It's possible, I haven't been through all of the source, but I can dig around and take a look.

Edit: based on the code, it doesn't look like this is the case, but I will try to get time to setup a use case to step through it asap.

if (result.Errors.Any(e => !e.IsWarning)) return result;

failwyn avatar Jan 24 '23 12:01 failwyn

Yeh noticed that line of code and started thinking it might be something else instead. Yeh if you get a chance let me know what the result is.

Cause I just found the error line it seems to be throwing https://github.com/madskristensen/WebCompiler/blob/c01fbbf785ea16a9b8784b1697e3095c3ffd0596/src/WebCompiler/MSBuild/CompilerBuildTask.cs#L59 so that makes me think that isWarning or logic around there is doing something maybe incorrectly.

pmonty avatar Jan 24 '23 22:01 pmonty

That line logs Errors and Warnings, but doesn't throw anything, so it shouldn't affect the result.

failwyn avatar Jan 25 '23 11:01 failwyn

Strange that the warning message in less is thrown as an error. Might wait to hear from the less team and go from there.

pmonty avatar Jan 27 '23 05:01 pmonty

Is it a better option to maybe use something other than "always" and then fix up issues? But in saying that there might be hundreds of errors.

Is it possible for me to compile a certain version of this and install that specific version manually? Maybe then I can try have logic if the error contains "always" then allow it to skip.

pmonty avatar Jan 30 '23 22:01 pmonty

I don’t really want to start introducing hacks to support deprecated parts of the LESS library; if the authors don’t want to support math=always, I’d say the best option would be to update the LESS files to be compliant or install an older version of WebCompiler and turn off automatic updates; there’s always going to be issues with backwards compatibility, but I feel like supporting the current language versions is more important.

failwyn avatar Jan 31 '23 00:01 failwyn

Is there a way to install a specific version in visual studio? Or do I need to clone this repo and make necessary changes then build?

pmonty avatar Feb 01 '23 04:02 pmonty

There's supposedly a way to browse Version History on Visual Studio Marketplace, but I can't find it; try this version.

https://marketplace.visualstudio.com/_apis/public/gallery/publishers/Failwyn/vsextensions/WebCompiler64/1.14.8/vspackage

// to download older versions, just change the version number in the url

failwyn avatar Feb 01 '23 11:02 failwyn