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

Support for less >= v3.0.0 #239

Closed
ngyikp opened this issue Feb 11, 2018 · 13 comments
Closed

Support for less >= v3.0.0 #239

ngyikp opened this issue Feb 11, 2018 · 13 comments

Comments

@ngyikp
Copy link

ngyikp commented Feb 11, 2018

Less.js v3 was just released: https://github.com/less/less.js/blob/master/CHANGELOG.md

Using the webpack resolver won't work correctly:

 FAIL  test/index.test.js
  ✓ should compile simple less without errors (305ms)
  ✕ should resolve all imports (20ms)
  ✕ should add all resolved imports as dependencies (12ms)
  ✕ should resolve all imports from node_modules using webpack's resolver (12ms)
  ✕ should add all resolved imports as dependencies, including node_modules (13ms)
  ✓ should resolve aliases as configured (13ms)
  ✓ should add all resolved imports as dependencies, including aliased ones (16ms)
  ✓ should resolve all imports from the given paths using Less' resolver (10ms)
  ✓ should add all resolved imports as dependencies, including those from the Less resolver (9ms)
  ✓ should allow to disable webpack's resolver by passing an empty paths array (9ms)
  ✕ should not try to resolve import urls (11ms)
  ✓ should allow to import non-less files (20ms)
  ✕ should compile data-uri function (15ms)
  ✕ should transform urls (20ms)
  ✕ should generate source maps with sourcesContent by default (13ms)
  ✕ should be possible to override sourceMap.outputSourceFiles (14ms)
  ✓ should install plugins (11ms)
  ✓ should not alter the original options object (9ms)
  ✕ should fail if a file is tried to be loaded from include paths and with webpack's resolver simultaneously (10ms)
  ✕ should provide a useful error message if the import could not be found (15ms)
  ✓ should provide a useful error message if there was a syntax error (11ms)
  ✕ should add a file with an error as dependency so that the watcher is triggered when the error is fixed (10ms)
  ✓ should be able to import a file with an absolute path (11ms)
@yuri-sakharov
Copy link

I just updated less to v3 and got

npm WARN [email protected] requires a peer of less@^2.3.1 but none is installed. You must install peer dependencies yourself.

@rejas
Copy link

rejas commented Feb 12, 2018

That warning already appeared in the alpha version of less3 but didnt lead to an exception.
I used alpha3 the whole time withoput a problem, only with the official v3 something changed (which is okay and expected, since it was labeld "alpha").
Just a hint for the maintainer to look into what changed between alpha3 and final version.

@ludoo0d0a
Copy link

for me , it is an issue :

less-loader 4.0.5 + less3.0.0 leads me to non-resolvable import for this case:

@import "~mypackage/styles/properties.less";

and in package, usage of local import in less files

@import "./other/part";
^
Can't resolve './other/part' in ...

Solved after a few hours with a rollback on "less": "^2.3.1".

@smoliakov
Copy link

Can not resolve imports though WebStorm sees files.

less 3.0.0
less-loader 4.0.5

@rm-bergmann
Copy link

Just updated to LESS 3.0.0 and also getting the above issues. I will roll back to 2.3.1 for now

@alexander-akait
Copy link
Member

PR welcome!

@yuri-sakharov
Copy link

I investigated and found:

@RinkAttendant6
Copy link

Are these issues also applicable with the Less resolver (as opposed to the Webpack resolver)?

I'm moving my compilation process from Grunt to Webpack and so far everything is OK with Less 3.0.0 (there was only one difference between the output of my two builds), but I don't want to run into anything problematic down the line.

@rejas
Copy link

rejas commented Feb 23, 2018

thx to @RinkAttendant6 i could fix the compilation for me. Using the less resolver

loader: 'less-loader',
                        options: {
                            paths: [
                                path.resolve(__dirname, 'node_modules')
                            ]
                        }

and writing my imports like this

@import '~tinyreset/tinyreset.css'; // lib from node_modules
@import 'base/util'; // own less code

fixed my issue. Hope this helps others.

@rejas
Copy link

rejas commented Feb 23, 2018

Grmpfl, doing this seems to have sideffect on subsequent builds when using a watch task. Will have to investigate further (or wait fore the official less3 support from #242)

@RinkAttendant6
Copy link

@rejas If I may ask, what side effects did you encounter when running the watch task?

@michael-ciniawsky michael-ciniawsky modified the milestones: 5.0.0, 4.0.6 Feb 23, 2018
@michael-ciniawsky michael-ciniawsky changed the title Support for Less v3? Support for less >= v3.0.0 Feb 23, 2018
@rejas
Copy link

rejas commented Feb 26, 2018

@RinkAttendant6 running my build pipeline once (for production) works like expected. but when i run my develop pipeline which has watch tasks that trigger a build the final output doesnt change :-(

@michael-ciniawsky
Copy link
Member

Released in v4.1.0 🎉

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

No branches or pull requests

9 participants