diff --git a/packages/koot-webpack/plugins/spa-template.js b/packages/koot-webpack/plugins/spa-template.js index 3a70561a..0c7865ce 100644 --- a/packages/koot-webpack/plugins/spa-template.js +++ b/packages/koot-webpack/plugins/spa-template.js @@ -123,11 +123,19 @@ class SpaTemplatePlugin { })() // console.log(Object.assign({}, defaultInject, inject)) + const projectInject = ((thisModule) => { + if (typeof thisModule.default === 'object') + return thisModule.default + if (typeof thisModule === 'object') + return thisModule + return {} + })(eval(fs.readFileSync(inject, 'utf-8'))) + const html = renderTemplate({ template, inject: { ...defaultInject, - ...eval(fs.readFileSync(inject, 'utf-8')).default + ...projectInject }, compilation }) diff --git a/packages/koot/CHANGELOG.md b/packages/koot/CHANGELOG.md index fabf21b2..9cc31105 100644 --- a/packages/koot/CHANGELOG.md +++ b/packages/koot/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.8.4 +**2019-03-29** +- React SPA + - 进一步优化模板注入 + ## 0.8.3 **2019-03-29** - 错误修正