Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita779c8c

Browse files
fix: use correctFileTemplate when enablepreserve_modules (#4517)
<!-- Thank you for contributing! -->### Descriptionrefhttps://github.com/rollup/rollup/blob/061a0387c8654222620f602471d66afd3c582048/src/Chunk.ts?plain=1#L526-L529<!-- Please insert your description here and provide especially infoabout the "what" this PR is solving -->
1 parent5d243e7 commita779c8c

File tree

2 files changed

+6
-4
lines changed
  • crates/rolldown_common/src/chunk
  • packages/rolldown/tests/fixtures/topics/preserve-modules

2 files changed

+6
-4
lines changed

‎crates/rolldown_common/src/chunk/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ impl Chunk {
117117
options:&NormalizedBundlerOptions,
118118
rollup_pre_rendered_chunk:&RollupPreRenderedChunk,
119119
) -> anyhow::Result<FilenameTemplate>{
120+
// https://github.com/rollup/rollup/blob/061a0387c8654222620f602471d66afd3c582048/src/Chunk.ts?plain=1#L526-L529
120121
let ret =ifmatches!(self.kind,ChunkKind::EntryPoint{ is_user_defined, ..}if is_user_defined)
122+
|| options.preserve_modules
121123
{
122124
options.entry_filenames.call(rollup_pre_rendered_chunk).await?
123125
}else{

‎packages/rolldown/tests/fixtures/topics/preserve-modules/_config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ export default defineTest({
1212
afterTest:(output)=>{
1313
expect(output.output[0].fileName).toMatchInlineSnapshot(`"main.js"`);
1414
expect(output.output[0].code).toMatchInlineSnapshot(`
15-
"import { a } from "./src/index-DGfmz2Yl.js";
16-
import { lib } from "./lib-i3NB89bx.js";
15+
"import { a } from "./src/index.js";
16+
import { lib } from "./lib.js";
1717
1818
//#region main.js
1919
console.log(lib, a);
2020
2121
//#endregion"
2222
`);
23-
expect(output.output[1].fileName).toMatchInlineSnapshot(`"lib-i3NB89bx.js"`);
23+
expect(output.output[1].fileName).toMatchInlineSnapshot(`"lib.js"`);
2424
expect((output.output[1]asOutputChunk).code).toMatchInlineSnapshot(`
2525
"//#region lib.js
2626
const lib = "lib";
2727
2828
//#endregion
2929
export { lib };"
3030
`)
31-
expect(output.output[2].fileName).toMatchInlineSnapshot(`"src/index-DGfmz2Yl.js"`);
31+
expect(output.output[2].fileName).toMatchInlineSnapshot(`"src/index.js"`);
3232
expect((output.output[2]asOutputChunk).code).toMatchInlineSnapshot(`
3333
"//#region src/index.js
3434
const a = 100;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp