-
Notifications
You must be signed in to change notification settings - Fork 14
Description
- start with Universal starter app -- https://github.com/angular/universal-starter.git
- Use the webpack version
-- This has routing and lazy loaded route by default - Replace BrowserModule with WorkerAppModule -- I followed all the steps listed.
-
First issue is that lazy loaded routes require importScripts vs JSONP webpack loader - so the target in webpack had to be changed to webworker vs the default web. This appears to have a side affect of causing issues with the CommonChunkPlugin because in order to support 2 different target types in webpack you have to have separate webpack configs.
-
Second issue once I have changed the target to webpack and removed the common chunk plugin as a work around (not ideal) - I then ran into an issue where I received an error
Attempt to get base href from DOM from WebWorker. You must either provide a value for the APP_BASE_HREF token through DI or use the hash location strategy. ; Zone: ; Task: Promise.then ; Value: Error: Attempt to get base href from DOM from WebWorker. You must either provide a value for the APP_BASE_HREF token through DI or use the hash location strategy.
I tried providing the APP_BASE_HREF like this in my main.ts
bootstrapWorkerUi('webworker.js', [{provide: APP_BASE_HREF, useValue: location.pathname}])
but this did not work. Can you provide any pointers? Have you tried WorkerAppModule with
import {RouterModule} from '@angular/router';