1.0.0 • Published 5 months ago
@plugin-light/webpack-plugin-add-common-vendor v1.0.0
打包产物中引入 vendor
小程序下,在打包产物的 js 中引入 common/vendor.js,以修复某些情况下找不到模块的bug。
如何使用
安装
pnpm add @plugin-light/webpack-plugin-add-common-vendor -D在 vue.config.js 中添加如下设置:
const { AddCommonVendorPlugin } = require('@plugin-light/webpack-plugin-add-common-vendor');
module.exports = {
configureWebpack: {
plugins: [
new AddCommonVendorPlugin()
],
},
}也可以引入其暴露的核心方法:
const { addCommonVendorCore } = require('@plugin-light/webpack-plugin-add-common-vendor');
addCommonVendorCore({
pageSet,
assets,
subPackages,
outputDir,
postFix,
})类型
export type IAddCommonVendorOptions = {
postFix?: string;
fileList?: Array<string>;
content?: string;
};
export type IAddCommonVendorCoreOptions = {
pageSet: string[];
assets: Record<string, any>;
subPackages: string[],
outputDir: string;
postFix?: string;
};