Skip to content

Commit 122f65a

Browse files
paisanousafilipesilva
authored andcommitted
refactor(@angular/cli): exclude builtin modules
1 parent bd4cdb0 commit 122f65a

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

lib/bootstrap-local.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
const fs = require('fs');
55
const path = require('path');
66
const ts = require('typescript');
7-
const builtinModules = require('builtin-modules');
87

98

109
Error.stackTraceLimit = Infinity;
@@ -49,6 +48,7 @@ require.extensions['.ts'] = function (m, filename) {
4948

5049
const resolve = require('resolve');
5150

51+
const builtinModules = Object.keys(process.binding('natives'));
5252

5353
// Look if there's a .angular-cli.json file, and if so toggle process.cwd() resolution.
5454
const isAngularProject = fs.existsSync(path.join(process.cwd(), '.angular-cli.json'))
@@ -80,7 +80,7 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
8080
const p = path.join(packages[match].root, request.substr(match.length));
8181
return oldLoad.call(this, p, parent);
8282
} else {
83-
if (!(builtinModules.indexOf(request) > -1)) {
83+
if (!builtinModules.includes(request)) {
8484
try {
8585
if (isAngularProject) {
8686
return oldLoad.call(this, resolve.sync(request, { basedir: process.cwd() }), parent);

package-lock.json

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124
"@types/source-map": "0.5.2",
125125
"@types/webpack": "^3.0.5",
126126
"@types/webpack-sources": "^0.1.3",
127-
"builtin-modules": "2.0.0",
128127
"conventional-changelog": "1.1.0",
129128
"dtsgenerator": "^0.9.1",
130129
"eslint": "^3.11.0",

0 commit comments

Comments
 (0)