Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Faster build (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored Nov 17, 2017
1 parent 9e3a3a3 commit e5b61c8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
4 changes: 3 additions & 1 deletion cli/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions config/webpack/build-aot.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand All @@ -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({
Expand Down
6 changes: 4 additions & 2 deletions config/webpack/common.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -94,6 +95,7 @@ function getWebpackConfig(skyPagesConfig, argv = {}) {
{
enforce: 'pre',
loader: outPath('loader', 'sky-processor', 'preload'),
include: spaPath('src'),
exclude: /node_modules/
},
{
Expand Down
30 changes: 12 additions & 18 deletions lib/sky-pages-module-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';`
Expand All @@ -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');
Expand Down

0 comments on commit e5b61c8

Please sign in to comment.