2.0.0 • Published 5 years ago

@vendasta/hot-module-replacement v2.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
5 years ago

Running Hot Module Replacement on Lazy Loaded Modules

How to Use?

First you will need to install. This can be achieved by running

npm install @vendasta/hot-module-replacement

Next you will need to initialize the module for Hot Module Replacement. In the constructor of the module, call HotModuleReplacementService.initializeModule with the following parameters:

  • nodeModuleRef: the node module reference from the Webpack module API.
  • moduleRef: the module that Hot module replacement will be ran on.
  • lazyRoutes: the routes to run Hot Module Replacement on. For nested lazy loaded modules this should include the routes for any lazy loaded parent modules.
  • enable: (optional) To be set by an environment variable to toggle running (This can be used to turn on/off Hot Module replacement by using a npm script).
Example:
export class ExampleModule {
	constructor(moduleRef: NgModuleRef<ExampleModule>) {
		HotModuleReplacementService.initializeModule(module, moduleRef, lazyRoutes, environment.enableHotModuleReplacement);
	}
}

Where lazyRoutes is a defined constant with all of the lazy loaded routes.

2.0.0

5 years ago

1.0.0

5 years ago

0.0.0

6 years ago