mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
33 lines
710 B
JavaScript
33 lines
710 B
JavaScript
import { join } from 'node:path';
|
|
import { name } from '../package.json';
|
|
|
|
export default (api) => {
|
|
api.addRuntimePluginKey(() => 'request');
|
|
|
|
const namespace = 'plugin-request';
|
|
const absoluteFilePath = `${namespace}/request.js`;
|
|
|
|
let generatedOnce = false;
|
|
api.onGenerateFiles(() => {
|
|
if (generatedOnce) {
|
|
return;
|
|
}
|
|
generatedOnce = true;
|
|
api.copyTmpFiles({
|
|
namespace,
|
|
path: join(__dirname, 'template'),
|
|
});
|
|
});
|
|
|
|
api.addPluginExports(() => [
|
|
{
|
|
exportAll: true,
|
|
source: absoluteFilePath,
|
|
},
|
|
]);
|
|
|
|
api.addConfigType(() => ({
|
|
source: name,
|
|
}));
|
|
};
|