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

Faster build #340

Merged
merged 7 commits into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious about the different syntax here.

Copy link
Member Author

@Blackbaud-SteveBrush Blackbaud-SteveBrush Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will ONLY look in the root's runtime folder, instead of "any" runtime folder.

Copy link
Member Author

@Blackbaud-SteveBrush Blackbaud-SteveBrush Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, @Blackbaud-BobbyEarl it's recommended by Webpack docs to be more specific with loaders. https://webpack.js.org/guides/build-performance/#loaders

},
{
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