【发布时间】:2017-06-13 04:07:16
【问题描述】:
所以我需要配置我的应用程序的公用文件夹,换句话说, 我希望资产在生成的索引文件上指向我自己的路径 比如 src="mypublicpath/assets/app.js"
我很确定这是一个需要在 angular-cli.json 配置中设置的值。
这是我的文件
{
"project": {
"version": "1.0.0-beta.28.3",
"name": "ng-app-manager"
},
"apps": [
{
"root": "src",
"outDir": "../bundles/ng-app-manager",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"files": "src/**/*.ts",
"project": "src/tsconfig.json"
},
{
"files": "e2e/**/*.ts",
"project": "e2e/tsconfig.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
我只需要相当于 webpacks "publicPath"
【问题讨论】:
-
如果你使用 angular cli
v1.0.0你可以eject你的应用程序并更改 webpack 配置。弹出文档:github.com/angular/angular-cli/wiki/eject
标签: angular angular-cli