我正在使用Aurelia CLI和Express创建项目。
我创建了一个名为" public"的文件夹,还有一个名为" js"的文件夹。内部"公共"。 " js"文件夹包含' vendor-bundle.js'和' app-bundle.js'。
我的app.js文件包含以下代码:
app.use(express.static(path.join(__dirname, '/public')));
我的index.html:
<body aurelia-app="main">
<script src="js/vendor-bundle.js" data-main="aurelia-bootstrapper"> </script>
</body>
我的aurelia.json:
{
"name": "master-the-toefl",
"type": "project:application",
"platform": {
"id": "web",
"displayName": "Web",
"output": "public/js"
},
"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": "none",
"displayName": "None",
"fileExtension": ".css",
"source": "src/**/*.css"
},
"editor": {
"id": "sublime",
"displayName": "Sublime"
},
"unitTestRunner": {
"id": "none",
"displayName": "None"
},
"paths": {
"root": "src",
"resources": "src/resources",
"elements": "src/resources/elements",
"attributes": "src/resources/attributes",
"valueConverters": "src/resources/value-converters",
"bindingBehaviors": "src/resources/binding-behaviors"
},
"build": {
"targets": [
{
"id": "web",
"displayName": "Web",
"output": "public/js"
}
],
"loader": {
"type": "require",
"configTarget": "vendor-bundle.js",
"includeBundleMetadataInConfig": "auto",
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css"
],
"stub": false
}
]
},
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage"
},
"bundles": [
{
"name": "app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
]
},
{
"name": "vendor-bundle.js",
"prepend": [
"node_modules/bluebird/js/browser/bluebird.core.js",
"scripts/require.js"
],
"dependencies": [
"aurelia-binding",
......
它应该工作。但是,我的控制台显示以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/public/js/app-bundle.js
和
vendor-bundle.js:3297 Error: Script error for "main"(…)
我该怎么做才能解决它?