bundling changes

pull/1358/head
Jamie.Rees 7 years ago
parent 9305e3a66a
commit 13b6bee0eb

@ -127,8 +127,7 @@ var paths = {
}, },
bundle: { // This is the config for the bundler, you shouldn't need to change this bundle: { // This is the config for the bundler, you shouldn't need to change this
root: './', root: './',
dest: './lib/bundles/full.js', dest: './lib/bundle.js',
libdest: './lib/bundles/lib.js',
bundle: 'app/main.js', bundle: 'app/main.js',
app: 'app/**/*', app: 'app/**/*',
config: { config: {
@ -246,23 +245,12 @@ gulp.task('sass', function () {
}); });
// This bundles the entire application and libraries for deployment
gulp.task('bundle', function () { gulp.task('bundle', function () {
var builder = new systemJSBuilder(paths.bundle.root); var builder = new systemJSBuilder(paths.bundle.root);
builder.config(paths.bundle.config); builder.config(paths.bundle.config);
del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true }); del.sync(path.join(paths.wwwroot, paths.bundle.dest), { force: true });
return builder.bundle(paths.bundle.bundle, path.join(paths.wwwroot, paths.bundle.dest), { return builder.bundle(paths.bundle.bundle + (global.full ? '' : ' - [' + paths.bundle.app + ']'), path.join(paths.wwwroot, paths.bundle.dest), {
sourceMaps: true
})
})
// This bundles only third party dependencies for development
gulp.task('bundlelib', function () {
var builder = new systemJSBuilder(paths.bundle.root);
builder.config(paths.bundle.config);
del.sync(path.join(paths.wwwroot, paths.bundle.libdest), { force: true });
return builder.bundle(paths.bundle.bundle + ' - [' + paths.bundle.app + ']', path.join(paths.wwwroot, paths.bundle.libdest), {
sourceMaps: global.full sourceMaps: global.full
}) })
}) })
@ -281,10 +269,9 @@ gulp.task('typescript', function () {
}); });
gulp.task('fullvar', () => { global.full = true }); gulp.task('fullvar', () => { global.full = true });
gulp.task('libs')
gulp.task('copy', ['lib', 'libcss', 'libfonts', 'libimages', 'npm', 'modules']); gulp.task('copy', ['lib', 'libcss', 'libfonts', 'libimages', 'npm', 'modules']);
gulp.task('compile', callback => runSequence('copy', 'sass', callback)); gulp.task('compile', callback => runSequence('copy', 'sass', callback));
gulp.task('build', callback => runSequence('compile', 'bundlelib', callback)); gulp.task('build', callback => runSequence('compile', 'bundle', callback));
gulp.task('full', callback => runSequence('clean', 'compile', callback)); gulp.task('full', callback => runSequence('clean', 'compile', callback));
// Use this in a build server environment to compile and bundle everything // Use this in a build server environment to compile and bundle everything

@ -1,16 +1,13 @@
System.import('/app/config.js').then((module: any) => { System.config({
var config = module.config.systemJS; baseURL: '/lib',
System.config({ packages: {
baseURL: '/lib', '.': {
packages: { defaultExtension: 'js'
'.': { }
defaultExtension: 'js' },
} map: { app: '../app' }
}, })
map: { app: '../app' }
})
System.import(config.bundle ? 'bundles/full' : 'bundles/lib').then(() => { System.import('bundle').then(() => {
System.import('/app/main'); System.import('/app/main');
}) })
});
Loading…
Cancel
Save