Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrapWebWorker is transpiled to bootstrapWebworker, which throws a TypeError. #3658

Closed
manekinekko opened this issue Aug 15, 2015 · 6 comments
Assignees

Comments

@manekinekko
Copy link
Contributor

Hi,
I just noticed something weird when playing around with the Web Worker modules. It is about bootstrapWebWorker.

The TypeScript function name is called bootstrapWebWorker (with two capital "W") but the generated JavaScript name seems to turn to bootstrapWebworker (one capital "W") which throws a TypeError.

Here is how to reproduce this:

bootstrap.ts

/// <reference path="../typings/_custom.d.ts" />
import {bootstrap} from "angular2/src/web-workers/ui/application";
bootstrap('loader.js');

loader.ts

/// <reference path="../typings/_custom.d.ts" />
import './worker';

worker.ts

/// <reference path="../typings/_custom.d.ts" />
import {bootstrapWebWorker} from "angular2/src/web-workers/worker/application";
import {httpInjectables, formInjectables} from 'angular2/angular2'
import {routerInjectables} from 'angular2/router';

/*
 * App Component
 */
import {App} from './app';

bootstrapWebWorker(App, [httpInjectables, formInjectables, routerInjectables]);
// Uncaught TypeError: application_1.bootstrapWebWorker is not a function

See screenshot below.

image

I don't know if this is a TypeScript or Angular2 bug.

Versions information
  • angular@2.0.0-alpha.34
  • typescript@1.5.3
@jteplitz jteplitz self-assigned this Aug 15, 2015
@jteplitz
Copy link
Contributor

Hey @manekinekko, how are you transpiling angular? Are you using our gulp tasks or running it through the TypeScript compiler yourself?

@manekinekko
Copy link
Contributor Author

Hi @jteplitz602 I am using angular-class repo. It uses webpack and the tasks are defined in the package.json

@jteplitz
Copy link
Contributor

It looks like this is an issue with our npm release. I'll investigate on Monday. For now, the easiest way for you to work around it is to build angular from source since this doesn't appear to be a problem when you build angular directly:

  1. Clone github.com/angular/angular
  2. cd angular && npm install
  3. gulp build.js.dev
  4. Replace your current angular source with the source code generated in dist/js/dev/es5 | es6

@jteplitz
Copy link
Contributor

Sorry, this actually isn't a bug. We renamed bootstrapWebWorker in a1c53ee, which hasn't landed in npm yet. This should be fixed in the alpha35 release.

WebWorker support is still under active development so we're going to be making breaking changes to it for a while. I'd recommend you build from source as part of your app's build pipeline if you plan to use WebWorkers because things are changing so frequently.

@manekinekko
Copy link
Contributor Author

Sure! I understand. It is actually part of the Universal project I'm contributing to.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants