Aurelia:main.js、app.js和app.html仍然被请求,尽管有捆绑包

Aurelia:main.js、app.js和app.html仍然被请求,尽管有捆绑包,aurelia,Aurelia,在我正在运行的Aurelia应用程序中,我已经成功创建了一个包来加载所有脚本。这些脚本位于一个文件夹中,即/scripts/app/views,在这里您还可以找到my main.js、app.js和app.html 创建包后,如果检查应用程序根目录下的config.js文件,我会发现包中包含这3个文件 然而,当我重新加载应用程序时,浏览器会正确加载捆绑包,而不是每个文件,但仍然有3个对这3个文件的http请求。为什么会这样?我如何删除这些呼叫?这是否与它们是应用程序的“入口点”有关 进一步资料:

在我正在运行的Aurelia应用程序中,我已经成功创建了一个包来加载所有脚本。这些脚本位于一个文件夹中,即/scripts/app/views,在这里您还可以找到my main.js、app.js和app.html

创建包后,如果检查应用程序根目录下的config.js文件,我会发现包中包含这3个文件

然而,当我重新加载应用程序时,浏览器会正确加载捆绑包,而不是每个文件,但仍然有3个对这3个文件的http请求。为什么会这样?我如何删除这些呼叫?这是否与它们是应用程序的“入口点”有关

进一步资料:

  • 我使用JSPM
  • 我没有使用框架,我只是用JSPM和NPM安装了aurelia框架和其他组件,然后在上面移植了我的旧应用程序
  • 对于绑定,我将aurelia bundler节点模块与gulp一起使用:请参见下面的gulpfile
var gulp=需要('gulp'), bundler=require('aurelia-bundler'), uglify=需要('gulp-uglify'), htmlmin=require('gulp-htmlmin'), del=需要('del'); 变量配置={ 是的, 原力:没错, baseURL:'.',//应用程序的baseURL configPath:'./config.js',//config.js文件。必须在'baseURL'内` 捆绑包:{ “Scripts/build/app build”:{//bundle name/path。必须在`baseURL`内。最终路径为:`baseURL/dist/app build.js`。 包括:[ “[Scripts/app/***.js]”, “Scripts/app/***.html!text”, 'Content/*.css!text' ], 选项:{ 是的, 是的, 缩小:是的, 牧师:是的, 原力:没错, } }, “脚本/构建/供应商构建”:{ 包括:[ “jspm_软件包/npm/babel-runtime@5.8.38/helpers/class call check.js', “jspm_软件包/npm/babel-runtime@5.8.38/helpers/create class.js', “jspm_软件包/npm/babel-runtime@5.8.38/core js/object/define property.js', “jspm_包/npm/core-js@1.2.7/library/fn/object/define property.js', “jspm_软件包/npm/babel-runtime@5.8.38/core js/object/define properties.js', “jspm_包/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日志记录-console@1.0.0', 'npm:aurelia模板制作-binding@1.0.0', 'npm:aurelia模板制作-resources@1.1.1', 'npm:aurelia模板制作-router@1.0.0', npm:aurelia-knockout@1.0.2', npm:aurelia历史-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动画师-css@1.0.1', 巴贝尔-core@5.8.38', 巴贝尔-runtime@5.8.38', “npm:核心-js@1.2.7', 'github:systemjs/plugin-text@0.0.9' ], 选项:{ 是的, 是的, 缩小:是的, 牧师:是的, 原力:没错, } } } }; 吞咽任务('clean',函数(){ 返回del.sync(['Scripts/build/**','!Scripts/build']); }); gulp.task('uglify',['clean'],函数(){ 返回gulp.src(['Scripts/accounts/i18n.js','Scripts/lib/i18n_error.js'])) .管道(丑() .pipe(gulp.dest(“脚本/构建”); }); 吞咽任务('minify',['uglify',],函数(){ 返回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',]函数(){ 返回bundler.bundle(配置); });
基于您提到一个
config.js
文件的事实,我假设您正在使用框架项目开始,并且正在使用jspm?如果需要帮助,您需要添加更多详细信息。你是如何开始的,你是如何捆绑的,等等。对不起,这是一个较长问题的一部分,可以在这里找到:,我从那里得到建议,将它分成多个问题。 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); });