Skip to content

Commit 520b2e7

Browse files
committed
cr
1 parent 8556fe6 commit 520b2e7

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

crates/rspack_plugin_esm_library/src/render.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl EsmLibraryPlugin {
125125
);
126126
}
127127
}
128+
break; // Only process the first entry module with hashbang/directives
128129
}
129130

130131
let mut replace_auto_public_path = false;

crates/rspack_plugin_rslib/src/plugin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ async fn render(
156156
}
157157

158158
render_source.source = new_source.boxed();
159+
break;
159160
}
160161

161162
Ok(())

crates/rspack_plugin_rslib/src/react_directives_parser_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl JavascriptParserPlugin for ReactDirectivesParserPlugin {
5757

5858
for (_, span) in directives {
5959
parser.add_presentational_dependency(Box::new(ConstDependency::new(
60-
(span.lo.0 - 1, span.hi.0 - 1).into(),
60+
span.into(),
6161
"".into(),
6262
None,
6363
)));

tests/rspack-test/configCases/rslib/hashbang-and-chmod/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const testCases = [
88
];
99

1010
testCases.forEach(({ name, file }) => {
11-
it (`should include hashbang at the first line (${name})`, () => {
11+
it(`should include hashbang at the first line (${name})`, () => {
1212
const filePath = path.resolve(__dirname, file);
1313
const content = fs.readFileSync(filePath, 'utf-8');
1414

tests/rspack-test/configCases/rslib/react-directives/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ const testCases = [
88
];
99

1010
testCases.forEach(({ name, file }) => {
11-
it (`should include React directives with double quotes (${name})`, () => {
11+
it(`should include React directives with double quotes (${name})`, () => {
1212
const filePath = path.resolve(__dirname, file);
1313
const content = fs.readFileSync(filePath, 'utf-8');
1414

1515
expect(content).toContain('"use client"');
1616
});
1717

18-
it (`should place directives before actual code (${name})`, () => {
18+
it(`should place directives before actual code (${name})`, () => {
1919
const filePath = path.resolve(__dirname, file);
2020
const content = fs.readFileSync(filePath, 'utf-8');
2121
const clientIndex = content.indexOf('"use client"');

0 commit comments

Comments
 (0)