File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ for (const file of files) {
13
13
// .js => .mjs
14
14
const content = fs . readFileSync ( file ) . toString ( "utf-8" ) ;
15
15
const newContent = content
16
- . replace ( / \b f r o m " ( \. \. ? \/ [ ^ " ] + ) .j s " ; / g, `from "$1.${ ext } ";` )
17
- . replace ( / \b i m p o r t " ( \. \. ? \/ [ ^ " ] + ) " ; / g, ' import "$1.mjs";' )
18
- . replace ( / \b r e q u i r e \( " ( \. \. ? \/ [ ^ " ] + ) .j s " \) / g, `require("$1.${ ext } ");` )
16
+ . replace ( / \b f r o m " ( \. \. ? \/ [ ^ " ] + ) (?: \ .j s ) ? " ; / g, `from "$1.${ ext } ";` )
17
+ . replace ( / \b i m p o r t " ( \. \. ? \/ [ ^ " ] + ) (?: \. j s ) ? " ; / g, ` import "$1.${ ext } ";` )
18
+ . replace ( / \b r e q u i r e \( " ( \. \. ? \/ [ ^ " ] + ) (?: \ .j s ) ? " \) / g, `require("$1.${ ext } ");` )
19
19
. replace ( / \/ \/ # s o u r c e M a p p i n g U R L = ( .+ ) \. j s \. m a p $ / , `//# sourceMappingURL=$1.${ ext } .map` ) ;
20
20
fs . writeFileSync ( fileMjs , newContent ) ;
21
21
fs . unlinkSync ( file ) ;
You can’t perform that action at this time.
0 commit comments