我正在尝试将index.html移动到子文件夹(在本例中是一个名为" app"的文件夹),但我无法使其与CLI一起使用。这是我的 aurelia.json
{
"name": "lv-app",
"type": "project:application",
"bundler": {
"id": "cli",
"displayName": "Aurelia-CLI"
},
"build": {
"targets": [
{
"id": "web",
"displayName": "Web",
"output": "app/scripts"
}
],
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage"
},
"bundles": [
{
"name": "app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
]
},
{
"name": "vendor-bundle.js",
"prepend": [
"node_modules/requirejs/require.js"
],
"dependencies": [
// dependencies omitted
]
}
],
"loader": {
"type": "require",
"configTarget": "vendor-bundle.js",
"includeBundleMetadataInConfig": "auto",
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub": true
}
]
}
},
"platform": {
"id": "web",
"displayName": "Web",
"baseDir": "./app"
},
"transpiler": {
"id": "babel",
"displayName": "Babel",
"fileExtension": ".js",
"options": {
"plugins": [
"transform-es2015-modules-amd"
]
},
"source": "src/**/*.js"
},
"markupProcessor": {
"id": "none",
"displayName": "None",
"fileExtension": ".html",
"source": "src/**/*.html"
},
"cssProcessor": {
"id": "postcss",
"displayName": "PostCSS",
"fileExtension": ".css",
"source": "src/**/*.css"
},
"paths": {
"root": "src",
"resources": "resources",
"elements": "resources/elements",
"attributes": "resources/attributes",
"valueConverters": "resources/value-converters",
"bindingBehaviors": "resources/binding-behaviors"
}
}
首先,我遇到了这个错误:
错误[Bundle]错误:无法更新供应商捆绑路径 app / scripts / vendor-bundle.js,找不到现有的引用 取代
修改
但我错误地配置了baseDir
。
更改"baseDir": "app/"
"baseDir": ". /app"
后,我收到了不同的错误。当我在localhost中加载web时,app-bundle.js显然不会加载,因为它指向错误的路由,如下图所示
正如您在下一张图片中看到的那样,vendor-bundle.js正在加载localhost:9000/scripts
no localhost:9000/app/scripts/