-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.
Description
What happens in node < 12
const Path = require('path');
Path.relative('/page1/page2/foo', '/');
// '../../..'
Path.relative('/page1/page2/foo', '/page1/');
// '../..'
Path.relative('/page1/page2/foo', '/page1/page2/');
// '..'What happens in node => 12
const Path = require('path');
Path.relative('/page1/page2/foo', '/');
// '../../../'
// ^--- Note the trailing slash
Path.relative('/page1/page2/foo', '/page1/');
// '../..'
Path.relative('/page1/page2/foo', '/page1/page2/');
// '..'Note the inconsistency when resolving a path against root. In node 12 we now get a trailing slash.
What I expect should happen
We either resolve all paths with or without trailing slashes but not mix both.
Nodes behavior prior to 12 was more consistent.
- 12.6.0
- OSX 10.14.5
sindresorhus
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.pathIssues and PRs related to the path subsystem.Issues and PRs related to the path subsystem.