Skip to content

fix(@angular/cli): exclude node_modules while take account for os specific path separators (#6870) #7158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 31, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@angular/cli/tasks/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class JsonWebpackSerializer {
return v;
} else if (typeof v == 'string') {
if (v === path.join(this._root, 'node_modules')) {
return this._serializeRegExp(/\/node_modules\//);
return this._relativePath('process.cwd()', 'node_modules');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually cannot rely on process.cwd() because the commands can be called from subfolders.

Can you replace this to this._serializeRegExp(/(\\|\/)node_modules(\\|\/)/) instead please? That way it supports both separators. This is also important for when the project is being ran in both Windows and OSX/Linux.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally makes sense this way... Will try it locally and then do the requested change

}
return this._relativePath('process.cwd()', path.relative(this._root, v));
} else {
Expand Down