File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export const DEFAULT_CONFIG_EXTENSIONS = [
1212export const SWC_HELPERS = '@swc/helpers' ;
1313export const RSLIB_ENTRY_QUERY = '__rslib_entry__' ;
1414export const SHEBANG_PREFIX = '#!' ;
15- export const SHEBANG_REGEX : RegExp = / # ! .* [ \s \n \r ] * / ;
15+ export const SHEBANG_REGEX : RegExp = / # ! .* [ \s \n \r ] * $ / ;
1616export const REACT_DIRECTIVE_REGEX : RegExp =
1717 / ^ [ ' " ] u s e ( c l i e n t | s e r v e r ) [ ' " ] ( ; ? ) [ \s \n \r ] * $ / ;
1818
Original file line number Diff line number Diff line change 1- import os from 'node:os' ;
1+ // import os from 'node:os';
22import type { LoaderDefinition } from '@rspack/core' ;
33import {
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 }
You can’t perform that action at this time.
0 commit comments