Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复 ES Module 的运行时插件无法注册的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed May 29, 2020
1 parent 50e3b0b commit 8e73f1d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ function () {
return this.plugins.reduce(function (acc, plugin) {
if (typeof plugin.onAppConfig === 'function') {
acc = plugin.onAppConfig({
config: config
config: acc
});
}

Expand All @@ -1620,7 +1620,7 @@ function () {
return this.plugins.reduce(function (acc, plugin) {
if (typeof plugin.onPageConfig === 'function') {
acc = plugin.onPageConfig({
config: config
config: acc
});
}

Expand Down Expand Up @@ -1928,7 +1928,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pluginDriver", function() { return pluginDriver; });
/* harmony import */ var _remax_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);

var pluginDriver = new _remax_runtime__WEBPACK_IMPORTED_MODULE_0__["PluginDriver"]([]);
var pluginDriver = new _remax_runtime__WEBPACK_IMPORTED_MODULE_0__["PluginDriver"]([].map(function (p) {
return p.default || p;
}));

/***/ }),
/* 23 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ function () {
return this.plugins.reduce(function (acc, plugin) {
if (typeof plugin.onAppConfig === 'function') {
acc = plugin.onAppConfig({
config: config
config: acc
});
}

Expand All @@ -1620,7 +1620,7 @@ function () {
return this.plugins.reduce(function (acc, plugin) {
if (typeof plugin.onPageConfig === 'function') {
acc = plugin.onPageConfig({
config: config
config: acc
});
}

Expand Down Expand Up @@ -1928,7 +1928,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pluginDriver", function() { return pluginDriver; });
/* harmony import */ var _remax_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);

var pluginDriver = new _remax_runtime__WEBPACK_IMPORTED_MODULE_0__["PluginDriver"]([__webpack_require__(23)]);
var pluginDriver = new _remax_runtime__WEBPACK_IMPORTED_MODULE_0__["PluginDriver"]([__webpack_require__(23)].map(function (p) {
return p.default || p;
}));

/***/ }),
/* 23 */
Expand Down
3 changes: 1 addition & 2 deletions packages/remax-cli/template/plugin.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const pluginDriver = new PluginDriver([
<% pluginFiles.forEach(file => { %>
require('<%- file %>'),
<% }) %>
]);

].map(p => p.default || p));
4 changes: 2 additions & 2 deletions packages/remax-runtime/src/PluginDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class PluginDriver {
onAppConfig(config: any) {
return this.plugins.reduce((acc, plugin) => {
if (typeof plugin.onAppConfig === 'function') {
acc = plugin.onAppConfig({ config });
acc = plugin.onAppConfig({ config: acc });
}
return acc;
}, config);
Expand All @@ -22,7 +22,7 @@ export default class PluginDriver {
onPageConfig(config: any) {
return this.plugins.reduce((acc, plugin) => {
if (typeof plugin.onPageConfig === 'function') {
acc = plugin.onPageConfig({ config });
acc = plugin.onPageConfig({ config: acc });
}
return acc;
}, config);
Expand Down

0 comments on commit 8e73f1d

Please sign in to comment.