mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
22 lines
509 B
JavaScript
22 lines
509 B
JavaScript
|
|
import { readFileSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
const namespace = 'plugin-initstate';
|
|
|
|
export default (api) => {
|
|
api.addRuntimePluginKey(() => 'initstate');
|
|
|
|
const absRuntimeFilePath = join(namespace, 'runtime.js');
|
|
|
|
api.onGenerateFiles(() => {
|
|
api.writeTmpFile({
|
|
path: absRuntimeFilePath,
|
|
content: readFileSync(join(__dirname, 'template/runtime.tpl'), 'utf-8')
|
|
});
|
|
});
|
|
|
|
|
|
api.addRuntimePlugin(() => `@@/${absRuntimeFilePath}`);
|
|
};
|