Skip to content

Found some issues when using router #3

@earlyster

Description

@earlyster
  1. start with Universal starter app -- https://github.com/angular/universal-starter.git
  2. Use the webpack version
    -- This has routing and lazy loaded route by default
  3. 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';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions