My compile time is currently at 40 seconds and I'm looking for ways to speed it up.
I attempted setting the isolatedModules flag to true in the configuration but encountered an error:
error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
I am using webpack-stream within my Gulp task.
This is my Gulpfile.js
task:
gulp.src('./tsScripts/users')
.pipe(webpack(
{
entry: {
"core_users": "./Orchard.Web/Modules/Core/tsScripts/users/users.ts",
"resources_product": "./Orchard.Web/Modules/Resources/tsScripts/products/product.ts",
"resources_products": "./Orchard.Web/Modules/Resources/tsScripts/products/products.ts",
"xrm_contractors": "./Orchard.Web/Modules/Xrm/tsScripts/contractors/contractors.ts",
"xrm_contractors_create": "./Orchard.Web/Modules/Xrm/tsScripts/contractors/contractors.create.ts",
"xrm_contractors_edit": "./Orchard.Web/Modules/Xrm/tsScripts/contractors/contractors.edit.ts",
"xrm_contractors_details": "./Orchard.Web/Modules/Xrm/tsScripts/contractors/contractors.details.ts",
"resources_inventory": "./Orchard.Web/Modules/Resources/tsScripts/inventory/inventory.ts",
"resources_inventory_create": "./Orchard.Web/Modules/Resources/tsScripts/inventory/inventory.create.ts",
"resources_inventory_edit": "./Orchard.Web/Modules/Resources/tsScripts/inventory/inventory.edit.ts",
"resources_inventory_details": "./Orchard.Web/Modules/Resources/tsScripts/inventory/inventory.details.ts",
"phx_productRegistry": "./Orchard.Web/Modules/phx/tsScripts/productRegistry/productRegistry.ts",
"phx_productRegistry_create": "./Orchard.Web/Modules/phx/tsScripts/productRegistry/productRegistry.create.ts",
"phx_productRegistry_edit": "./Orchard.Web/Modules/phx/tsScripts/productRegistry/productRegistry.edit.ts",
"phx_productRegistry_details": "./Orchard.Web/Modules/phx/tsScripts/productRegistry/productRegistry.details.ts",
"vendor": "./Orchard.Web/Modules/Core/tsScripts/vendor.ts",
"polyfills": "./Orchard.Web/Modules/Core/tsScripts/polyfills.ts"
},
output: {
path: __dirname,
filename: "./[name].js"
},
resolve: {
extensions: ['', '.ts', '.js'],
unsafeCache: true,
},
cache: true,
devtool: 'eval',
module: {
loaders: [
{
test: /\.ts/,
loaders: ['ts-loader'],
exclude: [/\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/],
options: {
transpileOnly: true
}
},
]
},
plugins: [
new wpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
}),
new wpack.optimize.CommonsChunkPlugin(
{
name: "vendor",
minChunks: Infinity
})
]
}
))
.pipe(gulp.dest('Scripts/main/'));
vendor.ts
///<reference path="./typings/globals/core-js/index.d.ts"/>
///<reference path="./node_modules/@types/jquery/index.d.ts"/>
///<reference path="./node_modules/@types/select2/index.d.ts"/>
import 'zone.js/dist/zone';
import '@angular/common';
import '@angular/compiler';
import '@angular/core';
import '@angular/forms';
import '@angular/http';
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/router';
import 'jquery';
import 'angular2-datatable';
import 'angular2-modal';
import 'rxjs';
import 'datatables'
import 'select2'
Although everything is functioning correctly, the build duration of approximately 40 seconds is too long. I tried making jquery external which improved the time to 1-3 seconds. Maybe making angular2 external could help? Or perhaps I made a mistake causing webpack to search through my entire solution for files. Any assistance would be greatly appreciated.