diff --git a/packages/fes-plugin-icon/src/icons.tpl b/packages/fes-plugin-icon/src/icons.tpl index 9bb58afb..178eb7bf 100644 --- a/packages/fes-plugin-icon/src/icons.tpl +++ b/packages/fes-plugin-icon/src/icons.tpl @@ -1,9 +1,9 @@ {{#ICON_NAMES}} -import smile from './icons/{{.}}'; +import {{.}} from './icons/{{.}}'; {{/ICON_NAMES}} export default { {{#ICON_NAMES}} - {{.}} + {{.}}, {{/ICON_NAMES}} }; \ No newline at end of file diff --git a/packages/fes-plugin-icon/src/index.js b/packages/fes-plugin-icon/src/index.js index 9b7819ce..a320e45a 100644 --- a/packages/fes-plugin-icon/src/index.js +++ b/packages/fes-plugin-icon/src/index.js @@ -17,7 +17,9 @@ export default (api) => { const namespace = 'plugin-icon'; const absRuntimeFilePath = join(namespace, 'runtime.js'); - // TODO 监听 icons 文件变更,重新生成文件 + // 监听 icons 文件变更,重新生成文件 + api.addTmpGenerateWatcherPaths(() => join(api.paths.absSrcPath, 'icons')); + api.onGenerateFiles(async () => { const base = join(api.paths.absSrcPath, 'icons'); const iconFiles = api.utils.glob.sync('**/*', { diff --git a/packages/fes-preset-built-in/src/utils/generateFiles.js b/packages/fes-preset-built-in/src/utils/generateFiles.js index 3fd40cae..532e6255 100644 --- a/packages/fes-preset-built-in/src/utils/generateFiles.js +++ b/packages/fes-preset-built-in/src/utils/generateFiles.js @@ -32,7 +32,7 @@ export default async ({ api, watch }) => { 'all', lodash.throttle(async () => { await generate(); - }, 100), + }, 100) ); }