feat(cli): 生成的entry文件不再在window挂对象,通过构建自动挂载

This commit is contained in:
roymondchen 2022-08-03 19:03:02 +08:00 committed by jia000
parent 624da4c29a
commit 32fdf05eb1

View File

@ -27,13 +27,11 @@ const generateContent = (type: EntryType, map: Record<string, string>, component
});
const exportToken = `${type}s`;
const capitalToken = exportToken.charAt(0).toUpperCase() + exportToken.slice(1);
return prettyCode(`${importDeclarations.join(';')}
const ${exportToken}: Record<string, any> = {
${list.join(',')}
}
window.magicPreset${capitalToken} = ${exportToken};
export default ${exportToken};
`);
};