mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui build
This commit is contained in:
1 parent
9c45527522
commit
7dc31d02fa
15 files changed
+10521
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/* eslint-disable */
|
||||
import _ from 'lodash';
|
||||
|
||||
export default function mapWebpackUrlPrefix(mapList) {
|
||||
const rules = mapList.map((mappingRule) => {
|
||||
const regex = mappingRule.prefix.split('/').map(s => _.escapeRegExp(s)).join('[\\/\\\\]');
|
||||
return {
|
||||
from: new RegExp(`^${regex}`, mappingRule.flag),
|
||||
to: mappingRule.replace,
|
||||
};
|
||||
});
|
||||
return function mapUrl(url) {
|
||||
rules.forEach((rule) => {
|
||||
url = url.replace(rule.from, rule.to);
|
||||
});
|
||||
return url;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user