在Angular 2 JavaScript项目中包含Angular 2包

时间:2017-02-22 11:26:47

标签: javascript angular webpack

我使用this quickstart boilerplate在纯JavaScript中创建Angular 2应用程序。

我想要包含由WebPack构建的自定义Angular 2包。这有可能吗?如果是这样,最好的方法是什么?

目前,当我尝试将Dim connetionString As String Dim connection As SqlConnection Dim adapter As SqlDataAdapter Dim ds As New DataSet Dim i As Integer connetionString = "Data Source=Gadasini-aldigim\SQLEXPRESS;Initial Catalog=allgiz;Trusted_Connection=True" connection = New SqlConnection(connetionString) connection.Open() adapter = New SqlDataAdapter("SELECT * FROM gadalar", connection) adapter.Fill(ds) connection.Close() Dim html As New StringBuilder() html.Append("<div>") For i = 0 To ds.Tables(0).Rows.Count - 1 html.Append(+ ds.Tables(0).Rows(i).Item(1) +) Next html.Append("</div>") PlaceHolder1.Controls.Add(New Literal() With {.Text = html.ToString()}) 从包中添加到CustomModel时,我收到以下错误:

app.module

我在此复制了此错误的示例:https://plnkr.co/edit/FqgWgBj2xvPLJmkrsuz1

1 个答案:

答案 0 :(得分:0)

我认为这个问题与你的子模块的创建方式有关。与this github issue或此github issue一样,您可能需要这样:

resolve: { 
     modules: [ path.join(projectRoot, "node_modules") ] 
}
  

导致您的node_modules无法从__dirname,__ dirname获取   指向webpack.config文件夹

     

PS:但是如果你有自定义webpack编译过程,那可能比   __dirname将起作用:)