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

Update loader-utils. #21

Merged
merged 1 commit into from
Jun 18, 2020
Merged

Update loader-utils. #21

merged 1 commit into from
Jun 18, 2020

Conversation

vseventer
Copy link
Contributor

This Pull Request:

  • Updates the loader-utils dependency.
  • Adds an additional option, context (defaults to rootContext - the directory of the module).
  • Interpolates the filename at an earlier stage - this allows specifying the name as method (currently, the child compiler breaks on this).

var filename = options.name || path.basename(this.resourcePath);
var context = options.context || this.rootContext;
var name = options.name || path.basename(this.resourcePath);
var filename = loaderUtils.interpolateName(this, name, { context: context });
Copy link
Owner

@erikdesjardins erikdesjardins May 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this change; I used to use interpolateName but I removed it in v6.

Although it's been so long that I don't quite remember why...in the release notes I said "...[hash] is correctly updated when subresources change..." but this PR didn't break the hashes in the tests, so maybe it's fine? OTOH maybe I meant "when subresources change during watch builds" which isn't tested.

Thoughts?

Copy link
Contributor Author

@vseventer vseventer Jun 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikdesjardins Haven't noticed any problems in watch mode with my PR.

The reason I re-added interpolateName (and updated loader-utils) is because this allows for options.name to be a function returning a placeholder string. Passing this function as filename option directly to this._compilation.createChildCompiler doesn't work, so that's why I'm interpolating it before passing to the child compiler.

@erikdesjardins erikdesjardins merged commit 3be3900 into erikdesjardins:master Jun 18, 2020
@erikdesjardins
Copy link
Owner

Released in v7

@vseventer
Copy link
Contributor Author

Awesome, thank you!

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.

2 participants