简体   繁体   English

从目录运行Aurelia CLI应用程序

[英]Run Aurelia CLI app from a directory

I would like to deploy my app to a virtual directory. 我想将我的应用程序部署到虚拟目录。 I have been unable to figure out the correct configuration needed to run the app locally with a similar structure. 我无法找出以类似结构在本地运行应用程序所需的正确配置。 For example, I'd like to run it from: 例如,我想从以下位置运行它:

http://localhost:8080/demos HTTP://本地主机:8080 /演示

I have tried every combination of adding "demos" to publicPath and contentBase in my webpack config. 我尝试了在Webpack配置publicPath “ demos”添加到publicPathcontentBase每种组合。 The errors just between 404's on static assets and router errors from Aurelia. 静态资产上的404错误与Aurelia的路由器错误之间的错误。

It is documented by Aurelia router, you can add base tag to index.html header, <base href="/demos"> , and set router root config.options.root = "/demos"; 它由Aurelia路由器记录,您可以将基本标签添加到index.html标头<base href="/demos"> ,并设置路由器根目录config.options.root = "/demos"; in configureRouter() . configureRouter()

In addition, if your bundled js files are indeed served from directory, you need to modified baseDir in 2 places of aurelia.json : platform.baseDir and build.targets[0].baseDir . 另外,如果确实从目录提供了捆绑的js文件,则需要在baseDir的2个地方修改aurelia.jsonplatform.baseDirbuild.targets[0].baseDir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM