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

Fix default path set to '.' #311

Merged
merged 1 commit into from
Dec 2, 2020
Merged

Fix default path set to '.' #311

merged 1 commit into from
Dec 2, 2020

Conversation

rosenfeld
Copy link
Contributor

The documentation says the default path is '.', however, without this fix,
by the time createOutputWriter was called, options.path was null and
the attempt to create the output directory would fail.

Copy link
Owner

@ztoben ztoben left a comment

Choose a reason for hiding this comment

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

Ah, yeah I see what you mean. I think it would make more sense to just correctly set the options.path value in the constructor.

@rosenfeld
Copy link
Contributor Author

Currently it uses the value of compiler.options.output.path when available, which is not accessible in the constructor. If we set the value in the constructor we have to give up on trying to use the value from compiler.options.output.path:

? (compiler.options.output.path || '.')

@ztoben
Copy link
Owner

ztoben commented Dec 2, 2020

Oh shoot, yeah you're right I forgot about that. Your change looks good then other than you should change the references from this to self.

index.js Outdated
@@ -39,6 +38,7 @@ AssetsWebpackPlugin.prototype = {
? (compiler.options.output.path || '.')
: (self.options.path || '.')
)
this.writer = createQueuedWriter(createOutputWriter(this.options))
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
this.writer = createQueuedWriter(createOutputWriter(this.options))
self.writer = createQueuedWriter(createOutputWriter(self.options))

The documentation says the default path is '.', however, without this fix,
by the time createOutputWriter was called, options.path was null and
the attempt to create the output directory would fail.
@rosenfeld
Copy link
Contributor Author

Okay, I've updated to use self rather than this and updated the PR.

@ztoben ztoben merged commit fbdcefa into ztoben:master Dec 2, 2020
@ztoben
Copy link
Owner

ztoben commented Dec 2, 2020

@rosenfeld should be available in v6.0.6. Thanks!

@rosenfeld
Copy link
Contributor Author

Thanks!

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.

None yet

2 participants