MCPcopy Create free account
hub / github.com/liady/webpack-node-externals / getModuleName

Function getModuleName

index.js:8–22  ·  view source on GitHub ↗
(request, includeAbsolutePaths)

Source from the content-addressed store, hash-verified

6);
7
8function getModuleName(request, includeAbsolutePaths) {
9 let req = request;
10 const delimiter = '/';
11
12 if (includeAbsolutePaths) {
13 req = req.replace(/^.*?\/node_modules\//, '');
14 }
15 // check if scoped module
16 if (scopedModuleRegex.test(req)) {
17 // reset regexp
18 scopedModuleRegex.lastIndex = 0;
19 return req.split(delimiter, 2).join(delimiter);
20 }
21 return req.split(delimiter)[0];
22}
23
24module.exports = function nodeExternals(options) {
25 options = options || {};

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…