mirror of https://github.com/webpack/webpack.git
Merge pull request #10279 from jamesgeorge007/tweaks
chore(NormalModule): refactor code adhering to ES6 semantics
This commit is contained in:
commit
b57fdd74f0
|
|
@ -78,7 +78,7 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => {
|
|||
*/
|
||||
const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
|
||||
if (!Array.isArray(sourceMap.sources)) return sourceMap;
|
||||
const sourceRoot = sourceMap.sourceRoot;
|
||||
const { sourceRoot } = sourceMap;
|
||||
/** @type {function(string): string} */
|
||||
const mapper = !sourceRoot
|
||||
? source => source
|
||||
|
|
@ -178,7 +178,7 @@ class NormalModule extends Module {
|
|||
* @param {string} options.rawRequest request without resolving
|
||||
* @param {LoaderItem[]} options.loaders list of loaders
|
||||
* @param {string} options.resource path + query of the real resource
|
||||
* @param {string | undefined} options.matchResource path + query of the matched resource (virtuel
|
||||
* @param {string | undefined} options.matchResource path + query of the matched resource (virtual)
|
||||
* @param {Parser} options.parser the parser used
|
||||
* @param {Generator} options.generator the generator used
|
||||
* @param {Object} options.resolveOptions options used for resolving requests from this module
|
||||
|
|
@ -663,7 +663,7 @@ class NormalModule extends Module {
|
|||
applyNoParseRule(rule, content) {
|
||||
// must start with "rule" if rule is a string
|
||||
if (typeof rule === "string") {
|
||||
return content.indexOf(rule) === 0;
|
||||
return content.startsWith(rule);
|
||||
}
|
||||
|
||||
if (typeof rule === "function") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue