-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
feat(package): support less >= v3.0.0
#242
Conversation
@thorn0 look very good, thanks! |
For the full test coverage we'll have to run tests with both Less 2.x and 3.x. Because of this: + less.version[0] >= 3
+ ? options.ext && !tildePrefixedModuleName.test(filename)
+ ? this.tryAppendExtension(filename, options.ext)
+ : filename
+ : filename.replace(matchMalformedModuleFilename, '$1'); |
@thorn0 can you do this? |
Also the tests sometimes fail now because of the race condition in Less: less/less.js#3170 |
@thorn0 i think we can fix this in other PR, but if solution is simple you can do this here 👍 |
Re running tests with Less 2. I can do it, but not sure when. Consider merging this as is and opening an issue. |
Let's submit this thing! @evilebottnawi |
Any chance this will get submitted soon? @evilebottnawi @jhnns @d3viant0ne @michael-ciniawsky |
less >= v3.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thorn0 Thx, to clearify is this PR backwards compatible (supports both less
v2.x && v3x) (🏷 Patch) or a BREAKING CHANGE (🏷 Major) ?
src/createWebpackLessPlugin.js
Outdated
// This somewhat changed in Less 3.x. Now the file name comes without the | ||
// automatically added extension whereas the extension is passed in as `options.ext`. | ||
// So, if the file name matches this regexp, we simply ignore the proposed extension. | ||
const tildePrefixedModuleName = /^~[^/\\]+$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tildePrefixedModuleName
=> isModule || isModuleName || isModuleRequest
src/createWebpackLessPlugin.js
Outdated
return false; | ||
} | ||
|
||
loadFile(filename, currentDirectory, options /* , environment */) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either enviroment
is needed or not, but please don't leave commented stuff
Seems to be a semver patch (Waiting for feedback) |
- "less": "^2.3.1",
+ "less": "^2.0.0 || ^3.0.0", |
Why not |
Only the major version is important here imho, this avoids noisy false warnings within the specified semver major ranges, e.g would |
I respectfully disagree. Minor version means added features. Are you sure we don't use any features added between 2.0 and 2.3? You're not, so why change this? |
Sure you can keep the status quo and just add |
@thorn0 Thx |
@thorn0, go for it! |
@thorn0 You rightfully opened this against the |
@michael-ciniawsky done, pls have a look |
test/helpers/compile.js
Outdated
|
||
const fixturePath = path.resolve(__dirname, '..', 'fixtures'); | ||
const outputPath = path.resolve(__dirname, '..', 'output'); | ||
|
||
function compile(fixture, moduleRules, resolveAlias = {}) { | ||
return new Promise((resolve, reject) => { | ||
const entry = path.resolve(fixturePath, 'less', `${fixture}.less`); | ||
|
||
webpack({ | ||
const [majorVersion] = webpackPackageJson.version.split('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please drop this, I appreciate that you want to fix it, but adding webpack >= v4.0.0
to the CI setup will be part of #233 asap. The loader works with the webpack >= v4.0.0
Loader API (no affecting breaking changes between v3.0.0
=> v4.0.0
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? The tests don't pass without this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'm sure about that, please pin webpack
to ^3.0.0
(https://github.com/webpack-contrib/less-loader/blob/master/package.json#L65) instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to drop and g2g :)
Closes #239
is it good to be merged ? |
Any update on when this will be merged? |
less >= v3.0.0
less >= v3.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thorn0 Thx
Released in |
Issues
less >= v3.0.0
#239