# 自定义预加载
uni-app 项目中自定义加载资源。
# 如何使用
安装
pnpm add @plugin-light/webpack-plugin-custom-preload -D
在 vue.config.js
中添加如下设置:
const { CustomPreloadPlugin } = require('@plugin-light/webpack-plugin-custom-preload');
module.exports = {
configureWebpack: {
plugins: [
new CustomPreloadPlugin()
],
}
}
# 参数类型
type IHash = string | RegExp | Array<string>;
export interface ICustomPreloadOptions {
list?: Array<{
condition: {
hash?: IHash;
path?: IHash;
};
pages?: string | Array<string | Array<string>>;
}>
}