Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
fix: Extract loader name in more reliable way (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Sep 27, 2018
1 parent 2ece7cd commit bd139ab
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ function diffArray(prev, next) {
};
}

/** Extracts loader's name independently of Webpack's version */
function getLoaderName(entry) {
return (
entry.loader ||
(entry.use && entry.use[0] && entry.use[0].loader) ||
'<unknown loader>'
);
}

/**
* Ensures that the passed value is in an array or an array itself.
*
Expand Down Expand Up @@ -253,7 +262,7 @@ class SentryCliPlugin {
const input = {
loaders: sillyClone(
compilerOptions.module.loaders || compilerOptions.module.rules
).map(x => x.loader || x.use[0].loader),
).map(getLoaderName),
entry: sillyClone(compilerOptions.entry),
};

Expand All @@ -262,7 +271,7 @@ class SentryCliPlugin {
const output = {
loaders: sillyClone(
compilerOptions.module.loaders || compilerOptions.module.rules
).map(x => x.loader || x.use[0].loader),
).map(getLoaderName),
entry: sillyClone(compilerOptions.entry),
};

Expand Down

0 comments on commit bd139ab

Please sign in to comment.