less.js: Missing selector when using sourcemaps, plugins, and compiling Less files in parallel

I have some code like bottom.

	@root-name: business-bundle
    /* other file */
	.@{root-name} .wrapper{
		/* css... */
	}

When webpack use less 3.12.2, that is ok. But when use 3.13.0, webpack build error. image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 29 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@PengJiyuan @kirazxyun @Justineo etc please try testing with less@3.13.0-alpha.3

4.0.0 is also published, which contains this fix.

3.13.1 published

@PengJiyuan You’re right, the code in question shouldn’t fail outputting the chunk if source map building doesn’t work. It should be like:

                if (inputSource === undefined) {
                    this._css.push(chunk);
                    return;
                }

That would be a short-term fix, with the longer term fix being figuring out why one of the files has an incorrect import mapping. (It’s probably being re-used when compiled in parallel.)

So I can do the temporary band-aid solution soon, and figure out the cause after.

@PengJiyuan Can you create a reproducible example in a cloneable repo?

https://github.com/kirazxyun/less-question

This repo can reproduce the problem. You can run with ‘npm run build’,then view the results in the dist folder.