Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix module id conflict on a case insensitive OS (#3317)
Suppose we have to files named `date.js` and `Date.js`, `makeUnique` treats these two files are different currently. But on a case insensitive OS, they are the same file. The commit try to fix the problem.
- Loading branch information
1 parent
b99758b
commit 35e127c
Showing
19 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/chunking-form/samples/preserve-modules-id-case-sensitive/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
description: 'Preserve modules id case sensitive', | ||
options: { | ||
input: 'main.js', | ||
preserveModules: true, | ||
plugins: [ | ||
{ | ||
resolveId(id) { | ||
if (id.toLowerCase().includes('one')) { | ||
return id; | ||
} | ||
}, | ||
load(id) { | ||
if (id.toLowerCase().includes('one')) { | ||
return `export default '${id.replace('\0', '')}'`; | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
.../chunking-form/samples/preserve-modules-id-case-sensitive/_expected/amd/_virtual/_One1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define(function () { 'use strict'; | ||
|
||
var c = 'One1.js'; | ||
|
||
return c; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
.../chunking-form/samples/preserve-modules-id-case-sensitive/_expected/amd/_virtual/_One2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define(function () { 'use strict'; | ||
|
||
var b = 'One.js'; | ||
|
||
return b; | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/amd/_virtual/_one.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
define(function () { 'use strict'; | ||
|
||
var a = 'one.js'; | ||
|
||
return a; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/amd/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define(['./_virtual/_one', './_virtual/_One2', './_virtual/_One1'], function (_one, _One, _One1) { 'use strict'; | ||
|
||
window.APP = { a: _one, b: _One, c: _One1 }; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
.../chunking-form/samples/preserve-modules-id-case-sensitive/_expected/cjs/_virtual/_One1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var c = 'One1.js'; | ||
|
||
module.exports = c; |
5 changes: 5 additions & 0 deletions
5
.../chunking-form/samples/preserve-modules-id-case-sensitive/_expected/cjs/_virtual/_One2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var b = 'One.js'; | ||
|
||
module.exports = b; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/cjs/_virtual/_one.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var a = 'one.js'; | ||
|
||
module.exports = a; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/cjs/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
var _one = require('./_virtual/_one.js'); | ||
var _One = require('./_virtual/_One2.js'); | ||
var _One1 = require('./_virtual/_One1.js'); | ||
|
||
window.APP = { a: _one, b: _One, c: _One1 }; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/es/_virtual/_One1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var c = 'One1.js'; | ||
|
||
export default c; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/es/_virtual/_One2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var b = 'One.js'; | ||
|
||
export default b; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/es/_virtual/_one.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var a = 'one.js'; | ||
|
||
export default a; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/es/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import a from './_virtual/_one.js'; | ||
import b from './_virtual/_One2.js'; | ||
import c from './_virtual/_One1.js'; | ||
|
||
window.APP = { a, b, c }; |
10 changes: 10 additions & 0 deletions
10
...unking-form/samples/preserve-modules-id-case-sensitive/_expected/system/_virtual/_One1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var c = exports('default', 'One1.js'); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
...unking-form/samples/preserve-modules-id-case-sensitive/_expected/system/_virtual/_One2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var b = exports('default', 'One.js'); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
...hunking-form/samples/preserve-modules-id-case-sensitive/_expected/system/_virtual/_one.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var a = exports('default', 'one.js'); | ||
|
||
} | ||
}; | ||
}); |
18 changes: 18 additions & 0 deletions
18
test/chunking-form/samples/preserve-modules-id-case-sensitive/_expected/system/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
System.register(['./_virtual/_one.js', './_virtual/_One2.js', './_virtual/_One1.js'], function () { | ||
'use strict'; | ||
var a, b, c; | ||
return { | ||
setters: [function (module) { | ||
a = module.default; | ||
}, function (module) { | ||
b = module.default; | ||
}, function (module) { | ||
c = module.default; | ||
}], | ||
execute: function () { | ||
|
||
window.APP = { a, b, c }; | ||
|
||
} | ||
}; | ||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/preserve-modules-id-case-sensitive/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import a from '\0one.js'; | ||
import b from '\0One.js'; | ||
import c from '\0One1.js'; | ||
|
||
window.APP = { a, b, c }; |