How to use the getRemainingRequest function from loader-utils

Find comprehensive JavaScript loader-utils.getRemainingRequest code examples handpicked from public code repositorys.

32
33
34
35
36
37
38
39
40
41
	map = null;
}

processCss(content, map, {
	mode: moduleMode ? "local" : "global",
	from: loaderUtils.getRemainingRequest(this).split("!").pop(),
	to: loaderUtils.getCurrentRequest(this).split("!").pop(),
	query: query,
	loaderContext: this,
	sourceMap: sourceMap
fork icon0
star icon1
watch icon0

11
12
13
14
15
16
17
18
19
20
21
`;
	}


	const matchResource = `${this.resourcePath}.js`;
	const loader = `${loaderPath}?load`;
	const remaining = getRemainingRequest(this);
	const request = JSON.parse(
		stringifyRequest(this, `${matchResource}!=!${loader}!${remaining}`)
	);

fork icon186
star icon0
watch icon0

15
16
17
18
19
20
21
22
23
24
25
// 使用 vue scss loader
module.exports = function (content) {
  if (this.cacheable) {
    this.cacheable()
  }
  const rawRequest = utils.getRemainingRequest(this)
  const type = path.extname(rawRequest).slice(1)


  const loader = this.query.loaders[type]
  if (loader === undefined) {
fork icon0
star icon0
watch icon2

+ 5 other calls in file

37
38
39
40
41
42
43
44
45
46
// produces side effects such as linting.
function getRawRequest (
  { resource, loaderIndex, loaders },
  excludedPreLoaders = /eslint-loader/
) {
  return loaderUtils.getRemainingRequest({
    resource: resource,
    loaderIndex: loaderIndex,
    loaders: loaders.filter(loader => !excludedPreLoaders.test(loader.path))
  })
fork icon0
star icon0
watch icon0

+ 2 other calls in file

22
23
24
25
26
27
28
29
30
31
}

if (map) {
  sourceNode = SourceNode.fromStringWithSourceMap(content, new SourceMapConsumer(map));
} else {
  var fileName = loaderUtils.getRemainingRequest(this);

  sourceNode = new SourceNode(null, null, null);
  content.split('\n').forEach(function (line, idx) {
    sourceNode.add(new SourceNode(idx + 1, 0, fileName, `${line}\n`));
fork icon0
star icon0
watch icon0