Skip to content

Commit da7b451

Browse files
committed
feat(*): example of TypeScript conditional loading failing
Related to issue #1 - You'll get the exact url of the full Travis error log.
1 parent 27a7135 commit da7b451

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/bootstrap.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,33 @@ const providers = [
5959

6060
// if TypeScript could do conditional imports via require,
6161
// we wouldn't include all those modules in the final bundle ...
62-
import {usePreMiddleware, usePostMiddleware, Middleware} from '@ngrx/store';
63-
import {instrumentStore} from '@ngrx/devtools';
62+
import ngRxStore = require('@ngrx/store');
63+
import ngRxDevtools = require('@ngrx/devtools');
6464

6565
if (process.env.DEVTOOLS) {
66+
const ngRxStore = require('@ngrx/store');
67+
const ngRxDevtools = require('@ngrx/devtools');
6668
// the following acts just like redux middlewares ...
6769
// this is the logger middleware
68-
const actionLog: Middleware = action => { // action is the store which acts like an observable
70+
const actionLog: ngRxStore.Middleware = action => { // action is the store which acts like an observable
6971
return action.do(val => { // .do() is only a side-effect, it doesn't affect the value of the stream itself
7072
console.group(val.type);
7173
console.log('will dispatch', val);
7274
});
7375
};
74-
const stateLog: Middleware = state => {
76+
const stateLog: ngRxStore.Middleware = state => {
7577
return state.do(val => {
7678
console.log('state after dispatch', val);
7779
console.groupEnd();
7880
});
7981
};
80-
providers.push(usePreMiddleware(actionLog));
81-
providers.push(usePostMiddleware(stateLog));
82+
providers.push(<any>ngRxStore.usePreMiddleware(actionLog));
83+
providers.push(<any>ngRxStore.usePostMiddleware(stateLog));
8284

8385
// this is the devtools part middleware
84-
providers.push(instrumentStore());
86+
providers.push(<any>ngRxDevtools.instrumentStore());
8587
}
8688

8789
bootstrap(App, providers);
90+
91+
/// <reference path="../node_modules/@angular/core/src/di/provider.d.ts" />

0 commit comments

Comments
 (0)