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

Extend loader context (to support less-loader) #88

Merged

Conversation

Mesoptier
Copy link
Contributor

@Mesoptier Mesoptier commented Apr 10, 2020

The less-loader package uses the fs and loadModule properties on the loader context, but those were not provided by this package. So this PR adds them in.

A few notes:

  • The fs property is simply the imported NodeJS fs module. So if the user has configured a different filesystem using Webpack's inputFileSystem option this will not be forwarded into the workers. This might cause unexpected issues, but I don't directly see a nice way around this issue.
  • The actual loadModule function returns (besides source and sourceMap, which are strings) the module, which is an instance of NormalModule. This class cannot be trivially serialized, so I pass undefined instead. Again, this might cause unexpected issues.

Additionally, it looks like future less-loader versions will use getResolve instead of resolve just like sass-loader. So it would probably be a good idea to add support for that as well.

@jsf-clabot
Copy link

jsf-clabot commented Apr 10, 2020

CLA assistant check
All committers have signed the CLA.

@alexander-akait
Copy link
Member

Sorry for delay and thanks for the PR, let's improve serialization in other PRs

@alexander-akait alexander-akait merged commit ea5c9ad into webpack-contrib:master Jun 29, 2020
@qnighy qnighy mentioned this pull request Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants