UNPKG

@ali-i18n-fe/dada-component

Version:
28 lines (21 loc) 795 B
const { getCurrentPathConfig } = require("./"); const getTemplateServerConfig = require("../webpack/webpack.template"); const { webpackPromise } = require("./webpackPromise"); const { spendTime } = require("../webpack/utils/log"); const path = require("path"); const fs = require("fs"); async function buildTemplateJS(force = false) { const currentConfig = getCurrentPathConfig(); const configs = getTemplateServerConfig(currentConfig); // configs.watch = true; // configs.mode = "development"; const templateResultPath = path.resolve( configs.entry.template, "../dist/template.js" ); if (fs.existsSync(templateResultPath) && !force) { return; } return spendTime("构建组件模板", () => webpackPromise(configs))(); } module.exports = { buildTemplateJS };