An import ending in "/" is always an import of a directory.#10510
Conversation
|
Couldn't a path ending in a slash just be a file with no name but an implied extension? Ie, |
Nodefoo/.js a.js Result: SystemJSSystemJS always requires an extension so there's no ambiguity there. RequireJSRequireJS seems to allow this: main.js helper/.js: Result: logs ".js" ConclusionWe could always just take out the change here https://github.com/Microsoft/TypeScript/pull/10510/files#diff-08a3cc4f1f9a51dbb468c2810f5229d3R649 and all that would change would be traces. But then we would be allowing node users to import "foo/" matched by "foo/.ts", which would fail at runtime. On the other hand, the change makes the code more complicated and would forbid requirejs users from some valid imports. |
|
If you configure syatemjs with the default extension option, does it behave Do browserify and webpack work exactly the same as Node? On Wed, Aug 24, 2016, 9:41 AM Andy notifications@github.com wrote:
|
|
Filing a separate issue for that since it shouldn't block this: #10562 |
| @@ -11,10 +11,10 @@ export default { aIndex: 0 }; | |||
| import a from "."; | |||
| import aIndex from "./"; | |||
There was a problem hiding this comment.
Could you add test for when the filename is not "/a/index.ts"? this seems to only work when your filename is "index.ts"
|
@weswigham Take a look at systemjs/systemjs#1069 and systemjs/systemjs#1308. |
| } | ||
|
|
||
| /** A path ending with '/' refers to a directory only, never a file. */ | ||
| export function isPathToDirectory(path: string): boolean { |
There was a problem hiding this comment.
I do not see why this is true.. can we make it more declarative and call it pathEndsWithDirectorySeparator to avoid ppl making wrong assumptions.
|
👍 |
Fixes #9690