It seems that v3.10.0 breaks my build, webpack logs below:
ERROR in ./src/pages/score/components/current/no-join/index.less
Module build failed (from ./node_modules/[email protected]@mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/[email protected]@less-loader/dist/cjs.js):
Class constructor FileManager cannot be invoked without 'new'
in undefined (line undefined, column undefined)
at runLoaders (/home/admin/build/node_modules/[email protected]@webpack/lib/NormalModule.js:313:20)
at /home/admin/build/node_modules/[email protected]@loader-runner/lib/LoaderRunner.js:367:11
at /home/admin/build/node_modules/[email protected]@loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/admin/build/node_modules/[email protected]@loader-runner/lib/LoaderRunner.js:111:13)
Everything is ok when downgrade to v3.9.0, please investigate this issue and hope to fix it as soon as possible.
I have the same problem,you mast change you 'package.json' => "less": "~3.9.0", limit version
+1
+1
+1!
急 ~
+1
same problem
+1 version less 3.9.0 less-loader 4.1.0
可以把package.json中 less版本的 ^ 去掉 重新安装一下 v3.9.0 应该就可以解决问题 大家可以试一下
虽然 锁定了版本 但是由于 ^, 所以会下载3 一下的最新版本, 最新版本应该是有问题的。
+1
+1
const shortname = new this.less.FileManager().extractUrlParts(filename).filename;
这个类似代码引起的?
omg, i limited the version to 3.9.0,works.
Same here. npm picks up this "minor" release automatically, and breaks all of my builds. :(
+1
v3.10.0 same error
+1
hurry
+1
just use [email protected] every thing will be ok
@lixiaohulee unless you're not using less-loader and everything will not be ok
+1
+1
I have the same problem (((
+1
i have the same problem :/
This is an issue with an older version of less-loader, not Less, which did not inherit the Less filemanager correctly. less-loader 5.0 does. See: https://github.com/less/less.js/issues/3414#issuecomment-522223041
解决了吗?
解决了吗?
你可以,把你package.js 里的less依赖,重新安装最近小版本依赖。

+1
Oooooooooooops!!! Why not fix the problem as many projects has locked less-loader version with 4.1.0.
We're using antd which broke: https://github.com/ant-design/ant-design/issues/18343
How can we fix the issue?
@montanaflynn keep a older envrionment and generate locked dependencies map with npm-shrinkmap.json may be a good choice.
@aleen42 thanks, I hope this can be fixed soon, I'm not very familiar with all the npm stuff.
@montanaflynn I have met many times when we broke during building due to the unlocked dependencies, including sub dependencies. This is a confusing problems of NPM for most FE developers.
@aleen42 we fixed it by adding
"devDependencies": {
"less-loader": "^5.0.0"
}
Why does this problem arise?
Node.js version is not right?
It's not a node version issue.
@montanaflynn you can also fix the problem by specifying a sub version for less-loader temporarily:
devDepedencies: {
"less-loader": "4.1.0",
"less": "3.9.0"
}
Upgrade with
yarn upgrade less@^3.10.1 less-loader@^5.0.0
use "less": "~3.9.0"
+1
+1
Incidentally, for those watching this thread, I'll re-open and probably submit a fix later today for older less-loader versions, just to have things be less annoying.
It's one of those edge cases where actually using the Class syntax to replace a prototype function throws an error without new. A FileManager is supposed to always be invoked with new (that's the documented API), and older versions of less-loader apparently did not.
_Again, though, if you're looking at the thread, just updating to less-loader 5.0 fixes this incompatibility._
I think that it is better for less-loader to downgrade its dependencies below 3.9.0.
@aleen42 Why would that be necessary, when the latest version of less-loader works fine?
Assume that some projects may not need to take care the risk of high level upgrading from 4.x to 5.x.
+666
Can someone try: https://github.com/less/less.js/pull/3421?
Branch is at: https://github.com/matthew-dean/less.js/tree/release/v3.10.2
The challenge in testing this is that less-loader's own tests fail on 3.9.0, so it's not clear what's expected. But, with Less's exported classes transpiled down to functions, the same errors at least get triggered in less-loader, so it's not clear if that's expected output or not. It's also not clear _how_ or why this error occurs in Less loader v4, and doesn't occur in v5, except it may be a Webpack issue on v4?
In any case, if people can confirm that this branch as a Less dependency doesn't cause the class issue, then I'll merge it in.
+1 version less 3.9.0 less-loader 4.1.0
+1
+1
Manually specify less version :
npm i [email protected] -D
ok!!!
Fix by downgrade to 3.9.0
Just before, I delete the node_modules and type npm i, this error happen. So the latest version 3.10.1 still has this bug. I choose downgrade to 3.9.0
How would I fix this bug if I am using @zeit/next-less? Any help appreciated.
@ezgitek
npm i @zeit/next-less
npm i [email protected]
https://forum.vuejs.org/t/vue-cli/72008/7
"less": "^3.10.1",
"less-loader": "^5.0.0",
is running
Merged: https://github.com/less/less.js/pull/3421
No one with less-loader v4 issues seemed willing to test [3.10.2] 🤷♂, but in my testing, Less-loader's v4 tests broke differently with 3.10.1 (class constructor issue), and broke the same with this PR. So..... not sure if it fixes it, but it should be no worse?
I merged that possible fix into master (but not yet released to NPM). Still would love for someone to confirm before releasing instead of the +1's.
I can confirm I just tried the current master branch of less locally with less-loader ^4.1.0, and my project is able to build again. 👍
Thanks for your work on this!
@jenniferneale Thanks for confirming! I'll publish to NPM later today then, can't do it from work.
+1
Is this issue fixed with 3.10.3?
@H4ngman Should be. Re-open if not.
Most helpful comment
I have the same problem,you mast change you 'package.json' => "less": "~3.9.0", limit version