diff --git a/cli/build.js b/cli/build.js index cfa8b294..57a6aea7 100644 --- a/cli/build.js +++ b/cli/build.js @@ -42,7 +42,9 @@ function writeTSConfig() { './app/app.module.ts' ], 'exclude': [ - '../../node_modules' + 'node_modules', + skyPagesConfigUtil.outPath('node_modules'), + '**/*.spec.ts' ], 'compileOnSave': false, 'buildOnSave': false, diff --git a/config/webpack/build-aot.webpack.config.js b/config/webpack/build-aot.webpack.config.js index d9ab7d9e..8a65bfd2 100644 --- a/config/webpack/build-aot.webpack.config.js +++ b/config/webpack/build-aot.webpack.config.js @@ -34,7 +34,11 @@ function getWebpackConfig(skyPagesConfig, argv) { skyux: [skyPagesConfigUtil.spaPathTempSrc('skyux.ts')], app: [skyPagesConfigUtil.spaPathTempSrc('main-internal.aot.ts')] }, - devtool: 'source-map', + + // Disable sourcemaps for production: + // https://webpack.js.org/configuration/devtool/#production + devtool: undefined, + module: { rules: [ { @@ -46,7 +50,9 @@ function getWebpackConfig(skyPagesConfig, argv) { plugins: [ new ngtools.AotPlugin({ tsConfigPath: skyPagesConfigUtil.spaPathTempSrc('tsconfig.json'), - entryModule: skyPagesConfigUtil.spaPathTempSrc('app', 'app.module') + '#AppModule' + entryModule: skyPagesConfigUtil.spaPathTempSrc('app', 'app.module') + '#AppModule', + // Type checking handled by Builder's ts-linter utility. + typeChecking: false }), SaveMetadata, new webpack.optimize.UglifyJsPlugin({ diff --git a/config/webpack/common.webpack.config.js b/config/webpack/common.webpack.config.js index ec87660d..494874b5 100644 --- a/config/webpack/common.webpack.config.js +++ b/config/webpack/common.webpack.config.js @@ -75,8 +75,9 @@ function getWebpackConfig(skyPagesConfig, argv = {}) { rules: [ { enforce: 'pre', - test: /runtime\/config\.ts$/, - loader: outPath('loader', 'sky-app-config') + test: /config\.ts$/, + loader: outPath('loader', 'sky-app-config'), + include: outPath('runtime') }, { enforce: 'pre', @@ -94,6 +95,7 @@ function getWebpackConfig(skyPagesConfig, argv = {}) { { enforce: 'pre', loader: outPath('loader', 'sky-processor', 'preload'), + include: spaPath('src'), exclude: /node_modules/ }, { diff --git a/lib/sky-pages-module-generator.js b/lib/sky-pages-module-generator.js index 572fbc27..f4d7a877 100644 --- a/lib/sky-pages-module-generator.js +++ b/lib/sky-pages-module-generator.js @@ -67,26 +67,10 @@ function getSource(skyAppConfig) { 'SkyAppViewportService' ]; - if (skyAppConfig.skyux.auth) { - runtimeImports.push(`SkyAuthHttp`); - runtimeProviders.push(`{ - provide: SkyAuthHttp, - useClass: SkyAuthHttp, - deps: [XHRBackend, RequestOptions, SkyAuthTokenProvider, SkyAppConfig] - }`); - } - let nodeModuleImports = [ - `import { - Component, - Inject, - NgModule, - OnInit, - OnDestroy, - OpaqueToken - } from '@angular/core';`, + `import { Component, NgModule, OnDestroy, OnInit } from '@angular/core';`, `import { CommonModule } from '@angular/common';`, - `import { HttpModule, XHRBackend, RequestOptions } from '@angular/http';`, + `import { HttpModule } from '@angular/http';`, `import { FormsModule, ReactiveFormsModule } from '@angular/forms';`, `import { ActivatedRoute, RouterModule, Routes } from '@angular/router';`, `import { Subscription } from 'rxjs/Subscription';` @@ -105,6 +89,16 @@ function getSource(skyAppConfig) { 'AppExtrasModule' ]; + if (skyAppConfig.skyux.auth) { + nodeModuleImports.push(`import { XHRBackend, RequestOptions } from '@angular/http';`); + runtimeImports.push(`SkyAuthHttp`); + runtimeProviders.push(`{ + provide: SkyAuthHttp, + useClass: SkyAuthHttp, + deps: [XHRBackend, RequestOptions, SkyAuthTokenProvider, SkyAppConfig] + }`); + } + if (skyAppConfig.skyux.help) { nodeModuleImports.push(`import { BBHelpModule } from '@blackbaud/skyux-lib-help';`); runtimeModuleImports.push('BBHelpModule');