當通過構建我的應用程序AOT角CLI角2 AOT構建 - 需要的問題
即(NG建立--aot --prod)
我收到以下錯誤:
..app>ng build --prod --aot
10% building modules 2/2 modules 0 active Error encountered
resolving symbol values statically. Calling function 'require',
function calls are not supported. Consider replacing the function
or lambda with a reference to an exported function, resolving symbol
appComponent in ..app.component.ts, resolving symbol AppComponent
in ..app.component.ts
我的組件看起來像:
@Component({
selector: 'app-component',
template: `
...
<div class="centered">
<img [src]="logo">
</div>
....
`,
styles: [require('./app-component.component.css')]
})
export class LoginComponent {
private logo = require('./logo.png');
...
}
有沒有可用的解決方法?
函數調用,添加一個引用到一個功能 –
你能給我提供一個片段嗎?我嘗試創建一個新組件,並執行如下操作:export var logo = require('./ logo.png');但它也沒有效果。 – kazanDipi