less.js icon indicating copy to clipboard operation
less.js copied to clipboard

TypeError in Internet Explorer 11 because Object.assign doesn't exist there

Open mstum opened this issue 7 years ago • 8 comments
trafficstars

I'm using less.js version 3.8.1 in the Browser for local development (less.min.js from /dist from the 3.8.1 Release Source Zip), and in Internet Explorer 11 it throws a TypeError because Object.assign doesn't exist there. http://lesscss.org/usage/ says that IE11+ should be supported. Polyfilling Object.assign makes less.js work in Internet Explorer 11 as well.

Earlier Versions (upgraded from less.js 2.7.1) worked fine in IE.

image

mstum avatar Oct 10 '18 16:10 mstum

To save some time, here's the PR that introduced the issue: https://github.com/less/less.js/pull/3301

NickCraver avatar Oct 10 '18 16:10 NickCraver

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 07 '19 17:02 stale[bot]

Is commenting enough to make it un-stale? Not sure if there's anything else to do?

mstum avatar Feb 07 '19 21:02 mstum

I guess it is 😄 About the contents of your post. The package.json shows a polyfill in the devDependencies. My guess is that the polyfill is injected during the test suite but not bundled with the distributed version.

kevinramharak avatar Feb 08 '19 08:02 kevinramharak

IE11 is a low priority target, so this would be up-for-grabs to anyone to tackle.

matthew-dean avatar Feb 12 '19 01:02 matthew-dean

I have created a fix by checking for IE and including a polyfill. See: https://gist.github.com/Olli-Suutari/5991619a5ea6ec7f9f036def075a729e

Olli-Suutari avatar Feb 22 '19 09:02 Olli-Suutari

While this polyfill may have worked when v3.8.x was new, as of July 2021, version 4.1.1 will still not work with IE11 after applying the polyfill for Object.assign() method.

Today's less-4.1.1 file uses other JS functions that don't exist in IE11, like Object.getOwnPropertySymbols() and native Promises.

I suggest this issue be closed as it's no longer in scope to today's code or possibly merged into an overarching IE11 non-support issue.

I'd also ask that this discussion doesn't devolve into whether or not IE11 is worth anybody's time. The lesscss.org site lists IE11 as a supported browser, and is still within support status from Microsoft for the time being.

ronniedude avatar Aug 01 '21 15:08 ronniedude

Polyfill hint: Include this

<script src="https://polyfill.io/v3/polyfill.min.js?features=es5%2Ces2015"></script>

before including less.js, which should add all missing/needed features in case an incompatible browser (ie11 nowadays only) is used. The service will only return missing features so basically returns nothing when a modern browser is used. Should work with less 4.1.1 as well

lubber-de avatar Aug 26 '21 18:08 lubber-de