PatrickJS / angular-hmr

:fire: Angular Hot Module Replacement for Hot Module Reloading
https://patrickjs.com
Apache License 2.0
505 stars 46 forks source link

Make development vs production split clear in documentation #67

Open akrueger opened 6 years ago

akrueger commented 6 years ago

Hi, thanks for the great work.

Is it possible to update the documentation to have more clear division about using the library in different environments. It seems that running HMR in development is the happy path. I can't seem to find a straightforward way to split the code path when running in development vs production.

e.g. in this ng-cli example, I see a clear distinction:

https://github.com/jschwarty/angularcli-hmr-example/blob/master/src/main.ts

PatrickJS commented 6 years ago

can you make a PR for the readme

akrueger commented 6 years ago

I would be happy to, but unfortunately I haven't managed to get the library to work with my Webpack build. I'm not using ngRx yet (although I plan to) and it's not clear to me if this library will work without a store based on what I see in the MainModule class.

Will it work without ngRx ?

I have main.ts:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
import { enableProdMode } from '@angular/core'

import { AppModule } from './app/app.module'

if (process.env.ENV === 'production') {
  enableProdMode()
}

platformBrowserDynamic()
  .bootstrapModule(AppModule)
  .then(success => console.log('Bootstrap success'))
  .catch(error => console.error(error))

and app.component.ts

import { Component } from '@angular/core'

// Master styles
import '../assets/styles/global_styles.scss'

@Component({
  selector: 'portal-app',
  templateUrl: './app.component.html'
})
export class AppComponent {}