-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
In the browser console I am getting the error
Cannot read property 'then' of undefined
I am trying to require from inside an angular router loadChildren. In this way I could load into a module from an entirely different project. Localhost here is just used for testing this idea.
const routes: Routes = [
{ path: ``, loadChildren: () => new Promise(function (resolve) {
require('http://localhost:3100/testset-module-bundle.js').then((response: any) => {
resolve(response)
}
)
})
}
];I'm aware that wrapping it in another promise like that is kind of dumb, but it's just for test purposes so I have more control.
The bundled code output from webpack looks like:
var routes = [
{ path: "", loadChildren: function () { return new Promise(function (resolve) {
__webpack_require__(406).then(function (response) {
resolve(response);
});
}); }
}
];Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels