Skip to content

Commit 41c552b

Browse files
committed
www
1 parent fc198ad commit 41c552b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/core/src/constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const DEFAULT_CONFIG_EXTENSIONS = [
1212
export const SWC_HELPERS = '@swc/helpers';
1313
export const RSLIB_ENTRY_QUERY = '__rslib_entry__';
1414
export const SHEBANG_PREFIX = '#!';
15-
export const SHEBANG_REGEX: RegExp = /#!.*[\s\n\r]*/;
15+
export const SHEBANG_REGEX: RegExp = /#!.*[\s\n\r]*$/;
1616
export const REACT_DIRECTIVE_REGEX: RegExp =
1717
/^['"]use (client|server)['"](;?)[\s\n\r]*$/;
1818

packages/core/src/plugins/entryModuleLoader.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os from 'node:os';
1+
// import os from 'node:os';
22
import type { LoaderDefinition } from '@rspack/core';
33
import {
44
REACT_DIRECTIVE_REGEX,
@@ -10,14 +10,14 @@ const loader: LoaderDefinition = function loader(source) {
1010
let result = source;
1111

1212
if (this.resourceQuery === `?${RSLIB_ENTRY_QUERY}`) {
13-
console.log('👝', source.includes('\n'), source.includes('\r\n'));
14-
const [firstLine1, ...rest1] = result.split(os.EOL);
13+
// console.log('👝', source.includes('\n'), source.includes('\r\n'));
14+
const [firstLine1, ...rest1] = result.split('\n');
1515

1616
if (SHEBANG_REGEX.test(firstLine1!)) {
1717
result = rest1.join('\n');
1818
}
1919

20-
const [firstLine2, ...rest2] = result.split(os.EOL);
20+
const [firstLine2, ...rest2] = result.split('\n');
2121
if (REACT_DIRECTIVE_REGEX.test(firstLine2!)) {
2222
result = rest2.join('\n');
2323
}

0 commit comments

Comments
 (0)