-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get the right chunk name for preserve modules in Windows (#5625)
* add test * remove Windows drive prefix --------- Co-authored-by: Lukas Taegert-Atkinson <[email protected]>
- Loading branch information
1 parent
eb07813
commit fadebcd
Showing
4 changed files
with
43 additions
and
3 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
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,11 @@ | ||
const assert = require('node:assert'); | ||
module.exports = defineTest({ | ||
description: 'get right chunk name for preserve modules', | ||
command: 'rollup -c', | ||
result(code) { | ||
assert.ok( | ||
code.includes(`//→ ${__dirname.replace(/^(\/|[a-zA-Z]:\\)/, '').replace(/\\/g, '/')}/main.js`) | ||
); | ||
assert.ok(code.includes(`//→ sub.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,2 @@ | ||
import sub from '/sub.js'; | ||
assert.ok(sub); |
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 @@ | ||
export default { | ||
input: 'main.js', | ||
output: { | ||
format: 'es', | ||
preserveModules: true | ||
}, | ||
plugins: [ | ||
{ | ||
resolveId(id) { | ||
if (id.endsWith('sub.js')) { | ||
return id; | ||
} | ||
}, | ||
load(id) { | ||
if (id.endsWith('sub.js')) { | ||
return 'export default "sub.js url"'; | ||
} | ||
} | ||
} | ||
] | ||
}; |