This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 修复入口文件使用平台扩展名时生成的模板名错误的问题 (#1198)
- Loading branch information
Showing
8 changed files
with
30 additions
and
29 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
const extensions = ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx']; | ||
import { Platform } from '@remax/types'; | ||
|
||
export default extensions; | ||
const extensions = ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx']; | ||
|
||
export const matcher = new RegExp(`(${extensions.join('|')})$`); | ||
const matcher = new RegExp(`(${extensions.join('|')})$`); | ||
|
||
export const moduleMatcher = new RegExp(`(${extensions.filter(e => e !== '.json').join('|')})$`); | ||
|
||
export const rename = (file: string, ext = '.js') => file.replace(matcher, ext); | ||
|
||
export const targetExtensions = (target: Platform) => { | ||
let ext = extensions.map(ext => `.${target}${ext}`); | ||
if (target !== Platform.web) { | ||
ext = ext.concat(extensions.map(ext => `.mini${ext}`)); | ||
} | ||
return ext.concat(extensions); | ||
}; |
bdf4a67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: