Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

fix: use latest API (loader-utils) #61

Merged
merged 1 commit into from Jun 28, 2017

Conversation

mattlewis92
Copy link
Member

Fixes #59

This repo could probably do with some tests that would have caught this, unfortunately I don't have time right now to contribute them as well. I tested it locally in my project and it worked ok with these changes.

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

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

Thx

@@ -10,8 +10,8 @@ export default function (source, sourceMap) {
srcMap = inlineSourceMap.sourcemap;
}

const userOptions = loaderUtils.parseQuery(this.query);
const instrumenter = istanbulLibInstrument.createInstrumenter(
const userOptions = loaderUtils.getOptions(this);
Copy link
Member

Choose a reason for hiding this comment

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

- const userOptions = loaderUtils.getOptions(this);
+ const userOptions = loaderUtils.getOptions(this) || {};

loaderUtils.getOptions() returns null, if there aren't any options

Copy link
Member Author

Choose a reason for hiding this comment

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

This is safe as passing null as an arg to Object.assign just has it skip it without an error Object.assign({foo: 'bar'}, null) == {foo: 'bar'}

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

@michael-ciniawsky michael-ciniawsky changed the title fix: use latest loader-utils api fix: use latest API (loader-utils) Jun 26, 2017
@michael-ciniawsky michael-ciniawsky self-assigned this Jun 26, 2017
@michael-ciniawsky michael-ciniawsky merged commit 27cf4eb into webpack-contrib:master Jun 28, 2017
@michael-ciniawsky michael-ciniawsky added this to the 3.0.1 milestone Jun 28, 2017
@mattlewis92 mattlewis92 deleted the patch-2 branch June 28, 2017 19:40
@michael-ciniawsky michael-ciniawsky removed this from the 3.0.2 milestone Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants