reactor:解决微信小程序的「代码质量」在「JS 文件」提示:主包内,不应该存在主包未使用的 JS 文件
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
// 目的:解决微信小程序的「代码质量」在「JS 文件」提示:主包内,不应该存在主包未使用的 JS 文件
|
||||||
|
const files = import.meta.glob('./*/*.js', { eager: true });
|
||||||
|
let api = {};
|
||||||
|
Object.keys(files).forEach((key) => {
|
||||||
|
api = {
|
||||||
|
...api,
|
||||||
|
[key.replace(/(.*\/)*([^.]+).*/gi, '$2')]: files[key].default,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export default api;
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
const files = import.meta.glob('./*.js', { eager: true });
|
|
||||||
let api = {};
|
|
||||||
Object.keys(files).forEach((key) => {
|
|
||||||
api = {
|
|
||||||
...api,
|
|
||||||
[key.replace(/(.*\/)*([^.]+).*/gi, '$2')]: files[key].default,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
// TODO @芋艿:要不要删除
|
|
||||||
export default api;
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import $api from '@/sheep/api';
|
||||||
import $url from '@/sheep/url';
|
import $url from '@/sheep/url';
|
||||||
import $router from '@/sheep/router';
|
import $router from '@/sheep/router';
|
||||||
import $platform from '@/sheep/platform';
|
import $platform from '@/sheep/platform';
|
||||||
@@ -14,6 +15,7 @@ dayjs.extend(relativeTime);
|
|||||||
dayjs.extend(duration);
|
dayjs.extend(duration);
|
||||||
|
|
||||||
const sheep = {
|
const sheep = {
|
||||||
|
$api,
|
||||||
$store,
|
$store,
|
||||||
$url,
|
$url,
|
||||||
$router,
|
$router,
|
||||||
|
|||||||
Reference in New Issue
Block a user