changeset 93:8f2b2aed0df1

Update cli config to conform to latest version, needed to move around my worker bootstrapping bodge. Angular-cli for some reason now includes global scripts as strings in the webpack bundle, and they are eval'ed. So TypeScript no longer gets compiled. So once again I chase the mouse, re-purposing the new polyfill field to compile and bundle externals.ts once more!
author Lucas Thompson <dev@lucas.im>
date Thu, 23 Feb 2017 22:15:52 +0000
parents 140f0a13dec9
children edddb2a5cf10
files angular-cli.json src/app/app.module.ts src/bootstrap-feature-extraction-worker.js
diffstat 3 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/angular-cli.json	Thu Feb 23 22:13:04 2017 +0000
+++ b/angular-cli.json	Thu Feb 23 22:15:52 2017 +0000
@@ -9,10 +9,12 @@
       "outDir": "dist",
       "assets": [
         "assets",
-        "favicon.ico"
+        "favicon.ico",
+        "bootstrap-feature-extraction-worker.js"
       ],
       "index": "index.html",
       "main": "main.ts",
+      "polyfills": "externals.ts",
       "test": "test.ts",
       "tsconfig": "tsconfig.json",
       "prefix": "app",
@@ -21,11 +23,10 @@
         "styles.css"
       ],
       "scripts": [
-        "../node_modules/requirejs/require.js",
-        "externals.ts"
+        "../node_modules/requirejs/require.js"
       ],
+      "environmentSource": "environments/environment.ts",
       "environments": {
-        "source": "environments/environment.ts",
         "dev": "environments/environment.ts",
         "prod": "environments/environment.prod.ts"
       }
--- a/src/app/app.module.ts	Thu Feb 23 22:13:04 2017 +0000
+++ b/src/app/app.module.ts	Thu Feb 23 22:15:52 2017 +0000
@@ -12,7 +12,7 @@
 import { FeatureExtractionService } from "./services/feature-extraction/feature-extraction.service";
 import { FeatureExtractionMenuComponent } from "./feature-extraction-menu/feature-extraction-menu.component";
 
-function createAudioContext(): AudioContext {
+export function createAudioContext(): AudioContext {
   return new (
     (window as any).AudioContext
     || (window as any).webkitAudioContext
@@ -34,7 +34,7 @@
     MaterialModule
   ],
   providers: [
-    {provide: HTMLAudioElement, useValue: new Audio()}, // TODO use something more generic than HTMLAudioElement
+    {provide: HTMLAudioElement, useValue: new Audio() }, // TODO use something more generic than HTMLAudioElement
     {provide: 'AudioContext', useValue: createAudioContext()}, // use a string token, Safari doesn't seem to like AudioContext
     AudioPlayerService,
     FeatureExtractionService,
--- a/src/bootstrap-feature-extraction-worker.js	Thu Feb 23 22:13:04 2017 +0000
+++ b/src/bootstrap-feature-extraction-worker.js	Thu Feb 23 22:15:52 2017 +0000
@@ -2,8 +2,9 @@
  * Created by lucas on 01/12/2016.
  */
 let window = {};
-importScripts('inline.bundle.js'); // provides webpackJsonp
+importScripts('/inline.bundle.js'); // provides webpackJsonp
 const webpackJsonp = window['webpackJsonp'];
-importScripts('scripts.bundle.js'); // needs webpackJsonp, hence above - provides require
+importScripts('/scripts.bundle.js'); // needs webpackJsonp, hence above - provides RequireJS
+importScripts('/polyfills.bundle.js'); // provides the compiled FeatureExtractionWorker
 
 new (require('feature-extraction-worker'))(self, requirejs);