在我运行的Aurelia应用程序中,我已经成功创建了一个包来加载我的所有脚本。这些脚本位于一个文件夹中,即/ Scripts / app / views,您可以在其中找到我的main.js,app.js和app.html。
创建捆绑包后,如果我检查应用程序根目录下的config.js文件,我看到我的捆绑包中包含这3个文件。
然而,当我重新加载应用程序时,浏览器正确加载了包而不是每个文件,但仍然有3个单个http请求到这3个文件。为什么这样,我该如何删除这些电话?它是否与应用程序的“切入点”有关?
更多信息:
var gulp = require('gulp'), bundler = require('aurelia-bundler'), uglify = require('gulp-uglify'), htmlmin = require('gulp-htmlmin'), del = require('del'); var config = { compact: true, force: true, baseURL: '.', // baseURL of the application configPath: './config.js', // config.js file. Must be within `baseURL` bundles: { "Scripts/build/app-build": { // bundle name/path. Must be within `baseURL`. Final path is: `baseURL/dist/app-build.js`. includes: [ '[Scripts/app/**/*.js]', 'Scripts/app/**/*.html!text', 'Content/*.css!text' ], options: { compact: true, inject: true, minify: true, rev: true, force: true, } }, "Scripts/build/vendor-build": { includes: [ 'jspm_packages/npm/babel-runtime@5.8.38/helpers/class-call-check.js', 'jspm_packages/npm/babel-runtime@5.8.38/helpers/create-class.js', 'jspm_packages/npm/babel-runtime@5.8.38/core-js/object/define-property.js', 'jspm_packages/npm/core-js@1.2.7/library/fn/object/define-property.js', 'jspm_packages/npm/babel-runtime@5.8.38/core-js/object/define-properties.js', 'jspm_packages/npm/core-js@1.2.7/library/fn/object/define-properties.js', 'npm:aurelia-framework@1.0.7', 'npm:aurelia-loader-default@1.0.0', 'npm:aurelia-logging-console@1.0.0', 'npm:aurelia-templating-binding@1.0.0', 'npm:aurelia-templating-resources@1.1.1', 'npm:aurelia-templating-router@1.0.0', 'npm:aurelia-knockout@1.0.2', 'npm:aurelia-history-browser@1.0.0', 'npm:aurelia-bootstrapper@1.0.0', 'npm:aurelia-fetch-client@1.0.1', 'npm:aurelia-router@1.0.6', 'npm:aurelia-animator-css@1.0.1', 'npm:babel-core@5.8.38', 'npm:babel-runtime@5.8.38', 'npm:core-js@1.2.7', 'github:systemjs/plugin-text@0.0.9' ], options: { compact: true, inject: true, minify: true, rev: true, force: true, } } } }; gulp.task('clean', function () { return del.sync(['Scripts/build/**', '!Scripts/build']); }); gulp.task('uglify', ['clean'], function () { return gulp.src(['Scripts/accounts/i18n.js', 'Scripts/lib/i18n_error.js']) .pipe(uglify()) .pipe(gulp.dest('Scripts/build')); }); gulp.task('minify', ['uglify'], function () { return gulp.src(['Scripts/app/views/error.html', 'templates/_head.html', 'templates/_contactSupportPanel.html']) .pipe(htmlmin({ collapseWhitespace: true })) .pipe(gulp.dest('Scripts/build')) }); gulp.task('build', ['minify'], function () { return bundler.bundle(config); });