These are chat archives for AngularClass/angular2-webpack-starter

30th
Jun 2016
Jaroslaw Ivanov
@ivanovjaroslaw
Jun 30 2016 01:42

Hi, guys. How can I use optional/conditional import 3rd party lib? I try to detect some specific env arg in webpack.common for ProvidePlugin - alright, it seems work. But in the code this is not working:

declare let CodeMirror: any;

Because, when there is no CodeMirror in ProvidePlugin, in my code there is an exception "ORIGINAL EXCEPTION: ReferenceError: CodeMirror is not defined". So, how can I declare variable in code to avoid this error? So, I just want to observe, is this variable is undefined, so, graceful degradation. If this is defined, so, I use extra functionality. Thanks.

Jared Youtsey
@jkyoutsey
Jun 30 2016 02:25
I'm seeing an interesting error with RC3 using the new router (3.0.0-alpha.7) and any production build: EXCEPTION: Error: Uncaught (in promise): Error: Cannot match any routes: ''
npm run server:prod gives that error, so does serving it up in nginx.
Ah, @bergvandenp is seeing the same thing. any progress?
Jared Youtsey
@jkyoutsey
Jun 30 2016 02:30
@rjlee7 It's a bit simpler now <a [routerLink]="['/dashboards']" routerLinkActive="router-link-active">
Jared Youtsey
@jkyoutsey
Jun 30 2016 02:36
My new router issue does not occur in dev. I'm going to remove build plugins until I can see where it fails.
Jared Youtsey
@jkyoutsey
Jun 30 2016 02:46
Removing Uglify, Dedup, and Md5 didn't change anything...
Paul van den Berg
@bergvandenp
Jun 30 2016 06:28
@jkyoutsey I just switched to LocationStrategy: HashlocationStrategy. That works like it supposed to
This message was deleted
bootstrap(AppComponent, [ APP_ROUTER_PROVIDERS, {provide: LocationStrategy, useClass: HashLocationStrategy}, ]);
that also prevents page reloads without the need to configure the server
Paul van den Berg
@bergvandenp
Jun 30 2016 06:43
@jkyoutsey i still get that error for my root path, because i didn't define a route for ''. I'll ignore that for now
Jehong Ahn
@toonitw
Jun 30 2016 12:28
This message was deleted
Jehong Ahn
@toonitw
Jun 30 2016 12:41

Hello. I need a help.
I want to add a new AsyncRoute. But there's an exception

export const routes: RouterConfig = [
  { path: 'detail', component: 'Detail', canActivate: [ WebpackAsyncRoute ] },
  { path: 'foo', component: 'Foo', canActivate: [ WebpackAsyncRoute ] },
];
export const asyncRoutes: AsyncRoutes = {
  'Detail': require('es6-promise-loader!./+detail'),
  'Foo': require('es6-promise-loader!./+foo')
};
export const prefetchRouteCallbacks: Array<IdleCallbacks> = [
  asyncRoutes['Detail'],
  asyncRoutes['Foo']
];

I cannot even change a route name.

export const routes: RouterConfig = [
  { path: 'detail', component: 'Foo', canActivate: [ WebpackAsyncRoute ] },
];
export const asyncRoutes: AsyncRoutes = {
  'Foo': require('es6-promise-loader!./+detail'),
};
export const prefetchRouteCallbacks: Array<IdleCallbacks> = [
  asyncRoutes['Foo'],
];

What happened?

99% Cocoa
@rjlee7
Jun 30 2016 14:03
@jkyoutsey thanks that worked great!
Jared Youtsey
@jkyoutsey
Jun 30 2016 15:58
I wonder if the router issue is happening with other builds, such as gulp? If so, then this is ng2 core bug.
@bergvandenp how are you working if your root path doesn't work?
rwobben
@rwobben
Jun 30 2016 17:29
Can I easily use ng prime things like the editable table with this template
Paul van den Berg
@bergvandenp
Jun 30 2016 19:32
@jkyoutsey it all works. it just gives me a console error
Are you guys having problems with sass-loader@4.0.0?
it tries to scan my entire system and doesn't have permissions on my timemachine folder lol
Ramses De La Peña Coronado
@ramsesDeco
Jun 30 2016 22:44
hi, someone can explain me why is node configuration like this? on webpack.prodution
node: {
    global: 'window',
    crypto: 'empty',
    process: false,
    module: false,
    clearImmediate: false,
    setImmediate: false
  }