Skip to content

BREAKING: ensure import paths are case-sensitive#630

Merged
Rich-Harris merged 3 commits intomasterfrom
gh-590
Aug 31, 2016
Merged

BREAKING: ensure import paths are case-sensitive#630
Rich-Harris merged 3 commits intomasterfrom
gh-590

Conversation

@Rich-Harris
Copy link
Contributor

Addresses #590. The suggestion there was that Rollup should warn if a module is imported twice with different casing, but to be honest I can't imagine a situation where you wouldn't want it to just fail altogether.

@guybedford
Copy link
Contributor

One thing to think about is that Es modules as implemented in browsers will be case sensitive as far as I am aware. I believe importing the same module with different cases will execute twice in browsers.

So strictly, this is implementing nonstandard behavior even though it makes the most sense. Perhaps @domenic can weigh in here as well.

@domenic
Copy link

domenic commented Apr 29, 2016

I believe importing the same module with different cases will execute twice in browsers.

Not unless your web server serves the same body for GET /foo.js and GET /FOO.js. Behavior there generally varies across servers, but e.g. GitHub.com 404s.

If you want to emulate strict web servers here, using fs.realPath and making sure the imported case matches the real path might be the way to go.

@tomByrer
Copy link

Hmmm, I've heard of this mixed case problem before. ;)

@Rich-Harris Rich-Harris merged commit 8dd88bf into master Aug 31, 2016
@Rich-Harris Rich-Harris deleted the gh-590 branch August 31, 2016 00:16
@Rich-Harris
Copy link
Contributor Author

Went ahead with the current implementation rather than realpath just because I expect that would cause some breaking behaviour with linked modules. Should be the same as regards case sensitivity. Can always revisit in future though. Thanks everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants