Add support for es6 modules for boot scripts
This commit is contained in:
parent
b7a14e30e1
commit
bfa874de63
|
@ -66,6 +66,7 @@ function runScripts(app, list, callback) {
|
|||
debug('Requiring script %s', filepath);
|
||||
try {
|
||||
var exports = require(filepath);
|
||||
if (exports.__esModule) exports = exports.default;
|
||||
if (typeof exports === 'function') {
|
||||
debug('Exported function detected %s', filepath);
|
||||
functions.push({
|
||||
|
|
|
@ -81,6 +81,7 @@ describe('Bootstrapper', function() {
|
|||
'promiseFinished',
|
||||
'thenableStarted',
|
||||
'thenableFinished',
|
||||
'umdLoaded',
|
||||
]);
|
||||
done();
|
||||
});
|
||||
|
|
|
@ -315,6 +315,7 @@ describe('executor', function() {
|
|||
'promiseFinished',
|
||||
'thenableStarted',
|
||||
'thenableFinished',
|
||||
'umdLoaded',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -337,6 +338,7 @@ describe('executor', function() {
|
|||
'promiseFinished',
|
||||
'thenableStarted',
|
||||
'thenableFinished',
|
||||
'umdLoaded',
|
||||
]);
|
||||
done();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright IBM Corp. 2017. All Rights Reserved.
|
||||
// Node module: loopback-boot
|
||||
// This file is licensed under the MIT License.
|
||||
// License text available at https://opensource.org/licenses/MIT
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
default: function() {
|
||||
process.bootFlags.push('umdLoaded');
|
||||
},
|
||||
};
|
||||
Object.defineProperty(module.exports, '__esModule', {value: true});
|
Loading…
Reference in New Issue