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

Don't mutate this.options (fixes #824) #826

Closed
wants to merge 2 commits into from
Closed

Don't mutate this.options (fixes #824) #826

wants to merge 2 commits into from

Conversation

arichardsmith
Copy link

As mentioned in #824, modifying the options object causes webpack to error if you run it more than once with the same config.

This PR stops lib/loader.js from setting this.options.__vueoptions__ and stops any other file from relying on it. I'm not sure if any other loader relies on this key, anything that does would be broken by this PR.

I've also had to rely on checking this._compiler.constructor.name in lib/style-compiler/index.js to check for happypack, I'm pretty sure that's what the original line was doing? It doesn't feel good but it will work. I don't have any experience with happypack, so I can't confirm if this makes a difference.

It passes all tests, I didn't think the changes needed a new test but I can write one if needed.
Hopefully I havn't missed anything!


if (!vueOptions) {
// Slightly messy check for HappyPack as we can't use this.options.__vueoptions__ anymore
if (this._compiler.constructor.name === 'HappyFakeCompiler') {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I cannot review this line due to I'm not very familiar with HappyPack. 🤔
/ping @yyx990803

@yyx990803
Copy link
Member

Thanks for the PR but the fix would actually break when there are non-stringifiable options being passed to the vue options. We should probably update the tests to ensure that's covered.

@yyx990803 yyx990803 closed this May 26, 2017
@arichardsmith arichardsmith deleted the patch-1 branch May 26, 2017 02:17
@arichardsmith
Copy link
Author

That figures. Thanks for fixing it anyway!

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